Skip to content
Snippets Groups Projects
Commit 025629b0 authored by Hai HoDac's avatar Hai HoDac
Browse files

fixed GUI layout

fixed new button bug
parent f78c86e4
Branches
No related tags found
No related merge requests found
...@@ -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