Skip to content
Snippets Groups Projects
Commit 80cad7a8 authored by Ho Dac Hai's avatar Ho Dac Hai
Browse files

Merge branch 'hai' into 'master'

fixed GUI layout

See merge request 1050369/comp90015-dsass2-infinitymonkeys-remaster!41
parents 2d99e358 025629b0
No related branches found
No related tags found
1 merge request!41fixed GUI layout
...@@ -94,6 +94,8 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis ...@@ -94,6 +94,8 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis
public void clear() { public void clear() {
image = new BufferedImage(AREA_WIDTH, AREA_HEIGHT, BufferedImage.TYPE_INT_ARGB); image = new BufferedImage(AREA_WIDTH, AREA_HEIGHT, BufferedImage.TYPE_INT_ARGB);
g2 = (Graphics2D) image.getGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
repaint(); repaint();
} }
......
package GUI; package GUI;
import client.Client; import client.Client;
import remote.IDrawingUpdate;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
...@@ -107,7 +106,7 @@ public class PaintGUI extends JPanel { ...@@ -107,7 +106,7 @@ public class PaintGUI extends JPanel {
// setFontBtn = new JButton("Font"); // setFontBtn = new JButton("Font");
// setFontBtn.addActionListener(actionListener); // setFontBtn.addActionListener(actionListener);
textInput = new JTextField("Text here."); textInput = new JTextField("Text here.");
textInput.setColumns(8); textInput.setColumns(13);
textInput.addFocusListener(focusListener); textInput.addFocusListener(focusListener);
// textInput.setVisible(false); // textInput.setVisible(false);
textSize = new JTextField("12"); textSize = new JTextField("12");
...@@ -409,7 +408,13 @@ public class PaintGUI extends JPanel { ...@@ -409,7 +408,13 @@ public class PaintGUI extends JPanel {
private void setTextDetail() { private void setTextDetail() {
String textString = textInput.getText(); String textString = textInput.getText();
int size = Integer.parseInt(textSize.getText()); int size = 12; // default
if (!textSize.getText().isEmpty()) {
size = Integer.parseInt(textSize.getText());
}
else {
textSize.setText(Integer.toString(size));
}
drawingArea.setModeText(textString, size); drawingArea.setModeText(textString, size);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment