Here's my code:
LoginPage:
public class LoginPage {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
#Override
public void run() {
try {
LoginPage window = new LoginPage();
window.frmLoginPage.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private JFrame frmLoginPage;
private JPasswordField passwordField;
private JTextField textField;
/**
* Create the application.
*/
public LoginPage() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmLoginPage = new JFrame();
frmLoginPage.setTitle("Login Page");
frmLoginPage.getContentPane().setBackground(new Color(100, 149, 237));
frmLoginPage.setBounds(100, 100, 742, 597);
frmLoginPage.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmLoginPage.getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBorder(new LineBorder(new Color(0, 0, 0), 3, true));
panel.setBackground(Color.WHITE);
panel.setBounds(131, 106, 459, 288);
frmLoginPage.getContentPane().add(panel);
panel.setLayout(null);
JLabel lblUserLogin = new JLabel("User Login");
lblUserLogin
.setIcon(new ImageIcon(LoginPage.class.getResource("/javax/swing/plaf/metal/icons/ocean/info.png")));
lblUserLogin.setFont(new Font("Trebuchet MS", Font.PLAIN, 34));
lblUserLogin.setHorizontalAlignment(SwingConstants.CENTER);
lblUserLogin.setBounds(114, 16, 243, 39);
panel.add(lblUserLogin);
JLabel lblUserId = new JLabel("User ID:");
lblUserId.setBounds(52, 75, 90, 20);
panel.add(lblUserId);
JLabel lblPassword = new JLabel("Password:");
lblPassword.setBounds(52, 140, 90, 20);
panel.add(lblPassword);
passwordField = new JPasswordField();
passwordField.setBounds(52, 176, 282, 26);
panel.add(passwordField);
textField = new JTextField();
textField.setBounds(52, 98, 283, 26);
panel.add(textField);
textField.setColumns(10);
JButton btnLogIn = new JButton("Log In");
btnLogIn.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent arg0) {
new SemesterPage();
frmLoginPage.setVisible(false);
}
});
btnLogIn.setBounds(52, 219, 115, 29);
panel.add(btnLogIn);
JButton btnRegister = new JButton("Register");
btnRegister.setBounds(179, 219, 115, 29);
panel.add(btnRegister);
}
}
And when the button "Log In" gets clicked, a new window within this class is supposed to pop up:
SemesterPage:
public class SemesterPage {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
#Override
public void run() {
try {
SemesterPage window = new SemesterPage();
window.frmControlPanel.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private JFrame frmControlPanel;
/**
* Create the application.
*/
public SemesterPage() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmControlPanel = new JFrame();
frmControlPanel.setTitle("Control Panel");
frmControlPanel.setBounds(100, 100, 1000, 1000);
frmControlPanel.getContentPane().setBackground(new Color(100, 149, 237));
JPanel panel = new JPanel();
panel.setBorder(new LineBorder(new Color(0, 0, 0), 2, true));
JPanel panel_1 = new JPanel();
panel_1.setBorder(new LineBorder(new Color(0, 0, 0), 2, true));
JPanel panel_2 = new JPanel();
panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 2, true));
GroupLayout groupLayout = new GroupLayout(frmControlPanel.getContentPane());
groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
.createSequentialGroup().addContainerGap()
.addComponent(panel, GroupLayout.PREFERRED_SIZE, 637, GroupLayout.PREFERRED_SIZE).addGap(30)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
.addComponent(panel_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap()));
groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup().addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(panel, GroupLayout.PREFERRED_SIZE, 793, GroupLayout.PREFERRED_SIZE)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 370,
GroupLayout.PREFERRED_SIZE)
.addGap(18).addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 412,
GroupLayout.PREFERRED_SIZE)))
.addContainerGap(97, Short.MAX_VALUE)));
frmControlPanel.getContentPane().setLayout(groupLayout);
frmControlPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
frmControlPanel.setJMenuBar(menuBar);
JMenu mnFile = new JMenu("File");
menuBar.add(mnFile);
JMenuItem mntmNew = new JMenuItem("New");
mnFile.add(mntmNew);
JMenuItem mntmSave = new JMenuItem("Save");
mnFile.add(mntmSave);
JMenuItem mntmLogOut = new JMenuItem("Log Out");
mnFile.add(mntmLogOut);
}
}
The problem is, the window does not pop up. Nothing happens when the button gets clicked. I have a feeling that when I call "new SemesterPage()", the constructor within my SemesterPage class does not start a JFrame. How would I go about fixing this?
Thank you very much!
You create a new instance of SemesterPage but never make it visible...
Your SemesterPage is going to need a method which will allow the caller to instruct it that it would like to make the instance of JFrame which it creates visible
Maybe something like...
public class SemesterPage {
private JFrame frmControlPanel;
//...
public void setVisible(boolean v) {
frmControlPanel.setVisible(v);
}
Having said that, you might want to reconsider your design slightly...
Start by having a look at The Use of Multiple JFrames, Good/Bad Practice?.
Then How to Make Dialogs and How to Use CardLayout for some ideas on alternatives
You might also consider having a look at Model-View-Controller, for example
Related
I am making a software which will pick only default directory after installation and from that file(in directory) a button will be linked to perform the task. I am unable to set and show default path which will look exactly like the given example in windows builder. It must be hard coded.
Example:-
private void initialize() {
frmPdfPublisher = new JFrame();
frmPdfPublisher.setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\Admin\\Desktop\\imageedit_1_6449501097.png"));
frmPdfPublisher.setTitle("PDF Publisher");
frmPdfPublisher.setBounds(100, 100, 450, 439);
frmPdfPublisher.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmPdfPublisher.getContentPane().setLayout(null);
JButton btnTransform = new JButton("Transform");
btnTransform.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnTransform.setBounds(76, 167, 89, 23);
frmPdfPublisher.getContentPane().add(btnTransform);
JButton btnPreview = new JButton("Preview");
btnPreview.setBounds(269, 167, 89, 23);
frmPdfPublisher.getContentPane().add(btnPreview);
JProgressBar progressBar = new JProgressBar();
progressBar.setBounds(138, 218, 146, 14);
frmPdfPublisher.getContentPane().add(progressBar);
JButton btnQuit = new JButton("Quit");
btnQuit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
btnQuit.setBounds(176, 288, 89, 23);
frmPdfPublisher.getContentPane().add(btnQuit);
JLabel lblLabel1 = new JLabel("Default DITA-OT File :");
lblLabel1.setBounds(10, 79, 123, 14);
frmPdfPublisher.getContentPane().add(lblLabel1);
JSeparator separator = new JSeparator();
separator.setBounds(10, 140, 414, 2);
frmPdfPublisher.getContentPane().add(separator);
JSeparator separator_1 = new JSeparator();
separator_1.setBounds(10, 257, 414, 2);
frmPdfPublisher.getContentPane().add(separator_1);
textField_1 = new JTextField();
textField_1.setBackground(SystemColor.menu);
textField_1.setBounds(138, 76, 286, 20);
frmPdfPublisher.getContentPane().add(textField_1);
textField_1.setColumns(10);
textField_1.setBorder(null);
textField_1.setText(System.getProperty("C:/Program Files/dita-ot-2.4"));
JMenuBar menuBar = new JMenuBar();
frmPdfPublisher.setJMenuBar(menuBar);
JMenu mnHelp = new JMenu("Option");
menuBar.add(mnHelp);
JMenuItem mntmHelp = new JMenuItem("Help");
mnHelp.add(mntmHelp);
}
}
See here for a list of system properties and their descriptions.
Instead of this ;
textField_1.setText(System.getProperty("C:/Program Files/dita-ot-2.4"));
Use this ;
textField_1.setText(System.getProperty("user.dir"));
If you want to use absolute path then you should use ;
textField_1.setText("C:/Program Files/dita-ot-2.4");
After implementing the Observer/Observable pattern, I can't really see why the Frame isn't showing when the code is executed.
I've looked over it a million times but can't figure it out.
I just want to know where I've gone wrong and how I can fix, so that the frame is showing.
Apologies for the code dump. Would be very grateful for the assistance.
public class MainGameFrame extends JFrame implements KeyListener,Observer {
private final JLabel lblPythonChallenge = DefaultComponentFactory
.getInstance().createTitle("Code Wars");
protected JTextArea textAreaEditable;
protected JTextArea textAreaQuestion;
protected JTextArea textAreaResult;
protected JTextArea textAreaScore;
protected PrintWriter output; // to write textArea stuff to file
private JTextArea textAreaPreview;
private JLabel lblPreview;
private ServerToClient model;
private Socket sock;
/**
* Create the application.
*/
public MainGameFrame() {
Thread t1 = new Thread(new Runnable() {
#Override
public void run() {
try {
sock = new Socket("127.0.0.1", 6789);
model = new ServerToClient(sock);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
initialize();
setVisible(true);
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
model.addObserver(this);
getContentPane().setBackground(new Color(153, 204, 102));
setForeground(Color.GREEN);
setBackground(Color.GREEN);
setTitle("Code Wars");
setBounds(100, 100, 762, 511);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
// TextArea 1
textAreaEditable = new JTextArea();
textAreaEditable.setBounds(10, 117, 353, 130);
getContentPane().add(textAreaEditable);
textAreaEditable.setTabSize(2); // fix tab size
// auto-indentation
textAreaEditable.registerKeyboardAction(new IndentNextLine(),
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
JComponent.WHEN_FOCUSED);
// add KeyListener
textAreaEditable.addKeyListener(this);
// TextArea 2
textAreaQuestion = new JTextArea();
textAreaQuestion.setBackground(new Color(255, 255, 255));
textAreaQuestion.setBounds(10, 34, 353, 46);
getContentPane().add(textAreaQuestion);
// TextArea 3
textAreaResult = new JTextArea();
textAreaResult.setBounds(10, 357, 713, 104);
getContentPane().add(textAreaResult);
textAreaResult.setEditable(false);
// JTextPane textPane_1 = new JTextPane();
// textPane_1.setBounds(463, 158, 273, 269);
// frmPythonChallenge.getContentPane().add(textPane_1);
// component 4
JButton btnRunCode = new JButton("Run Code");
btnRunCode.setBounds(10, 258, 330, 31);
getContentPane().add(btnRunCode);
btnRunCode.addActionListener(new RunButtonListener());
// TextArea 4
textAreaScore = new JTextArea();
textAreaScore.setBounds(373, 34, 350, 46);
getContentPane().add(textAreaScore);
lblPythonChallenge.setBounds(23, -31, 143, 31);
getContentPane().add(lblPythonChallenge);
JLabel lblEnterCodeIn = DefaultComponentFactory.getInstance()
.createLabel("Enter code in the box below:");
lblEnterCodeIn.setForeground(new Color(0, 100, 0));
lblEnterCodeIn.setFont(new Font("Tahoma", Font.BOLD, 12));
lblEnterCodeIn.setBounds(10, 91, 209, 15);
getContentPane().add(lblEnterCodeIn);
JLabel lblQuestion = DefaultComponentFactory.getInstance().createLabel(
"Question:");
lblQuestion.setForeground(new Color(0, 100, 0));
lblQuestion.setFont(new Font("Tahoma", Font.BOLD, 12));
lblQuestion.setBounds(10, 9, 92, 14);
getContentPane().add(lblQuestion);
JLabel lblScores = DefaultComponentFactory.getInstance().createLabel(
"Scores:");
lblScores.setForeground(new Color(0, 100, 0));
lblScores.setFont(new Font("Tahoma", Font.BOLD, 12));
lblScores.setBounds(373, 9, 92, 14);
getContentPane().add(lblScores);
JLabel lblThisIsThe = DefaultComponentFactory.getInstance()
.createLabel("This is the result from your code!");
lblThisIsThe.setForeground(new Color(0, 100, 0));
lblThisIsThe.setFont(new Font("Tahoma", Font.BOLD, 12));
lblThisIsThe.setBounds(10, 328, 238, 15);
getContentPane().add(lblThisIsThe);
// TextArea 5
textAreaPreview = new JTextArea();
textAreaPreview.setBounds(373, 117, 350, 130);
textAreaPreview.setTabSize(2);
textAreaPreview.setEditable(false);
getContentPane().add(textAreaPreview);
lblPreview = DefaultComponentFactory.getInstance().createLabel(
"Preview");
lblPreview.setForeground(new Color(0, 128, 0));
lblPreview.setFont(new Font("Tahoma", Font.BOLD, 12));
lblPreview.setLabelFor(lblPreview);
lblPreview.setBounds(373, 84, 200, 31);
getContentPane().add(lblPreview);
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainGameFrame window = new MainGameFrame();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
Change your main() method to this:
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainGameFrame window = new MainGameFrame();
window.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
At the end of the initialize() method, add some code that will make MainGameFrame() visible:
this.setVisible(true);
I also suggest you use a Layout Manager to organize the components. Oracle has some great tutorials on how to use different layouts. How to Use Various Layout Managers
I am creating a GUI in java. Currently i have an empty JFrame and am trying to add a JPanel to it. The JPanel contains buttons, text etc. However none of this is being properly displayed. My code is as follows:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class memoDisplayUI {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JTextArea jTextBox = new JTextArea();
JScrollPane scroll = new JScrollPane();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
memoDisplayUI frame = new memoDisplayUI();
frame.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public memoDisplayUI() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame.getContentPane().setBackground(new Color(255, 255, 255));
frame.getContentPane().setLayout(null);
frame.setBounds(100, 100, 270, 400);
frame.setUndecorated(true); //REMOVES MENU BAR
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel lblMemos = new JLabel("MEMOS");
lblMemos.setForeground(new Color(100, 149, 237));
lblMemos.setFont(new Font("Moire", Font.BOLD, 30));
lblMemos.setBounds(16, 16, 234, 37);
panel.add(lblMemos);
JButton button = new JButton("");
button.setBackground(new Color(100, 149, 237));
button.setBounds(7, 350, 40, 40);
panel.add(button);
button.setIcon(new ImageIcon("back.png"));
JButton button_1 = new JButton("");
button_1.setBackground(new Color(100, 149, 237));
button_1.setBounds(113, 350, 40, 40);
panel.add(button_1);
button_1.setIcon(new ImageIcon("Edit.png"));
JButton button_2 = new JButton("");
button_2.setBackground(new Color(100, 149, 237));
button_2.setBounds(220, 350, 40, 40);
panel.add(button_2);
button_2.setIcon(new ImageIcon("memo.png"));
JButton btnExit = new JButton("");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
btnExit.setBorder(null);
btnExit.setIcon(new ImageIcon("Exit.jpg"));
btnExit.setBounds(216, 19, 40, 40);
panel.add(btnExit);
jTextBox = new JTextArea();
scroll.setViewportView(jTextBox); // add scroll panel
jTextBox.setTabSize(4);
jTextBox.setLineWrap(true);
jTextBox.setBackground(new Color(192, 192, 192));
jTextBox.setBounds(8, 60, 255, 286);
panel.add(jTextBox);
frame.setContentPane(panel);
}
}
My desired layout is something very similar to this:
Could someone advise as to why this is.
Thanks for any help :)
I m creating a GUI in java and would like to use a JTextArea, however I am having a lot of trouble adding it to the frame. How would I go about creating a text Area and then using it to read text or display text?
Here is my GUI code so far:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class addMemoUI extends JFrame {
JFrame frame = new JFrame();
/**
* Create the application.
*/
public addMemoUI() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame.getContentPane().setBackground(new Color(255, 255, 255));
frame.getContentPane().setLayout(null);
JButton button = new JButton("Create");
button.setBackground(new Color(100, 149, 237));
button.setBounds(135, 350, 130, 50);
frame.getContentPane().add(button);
JLabel lblMemos = new JLabel("MEMOS");
lblMemos.setForeground(new Color(100, 149, 237));
lblMemos.setFont(new Font("Moire", Font.BOLD, 30));
lblMemos.setBounds(22, 21, 234, 37);
frame.getContentPane().add(lblMemos);
JButton button_1 = new JButton("Cancel");
button_1.setBackground(new Color(100, 149, 237));
button_1.setBounds(5, 350, 130, 50);
frame.getContentPane().add(button_1);
frame.setBounds(100, 100, 270, 400);
frame.setUndecorated(true); //REMOVES MENU BAR
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton btnExit = new JButton("");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MemoUI window = new MemoUI();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
Thanks very much :)
Here is example for how to use JTextArea. You can set, get or append text. You can find the others by google.
public class Example {
private JTextArea jtextbox;
private void initialize() {
JFrame frm = new JFrame();
:
JScrollPane scroll = new JScrollPane();
jtextbox= new JTextArea();
scroll.setViewportView(jtextbox); // add scroll panel
jtextbox.setTabSize(4);
jtextbox.setLineWrap(true);
jtextbox.setBackground(SystemColor.window);
}
private void setText(String text) {
jtextbox.append(text); // or setText(text)
}
private String getText() {
return jtextbox.getText();
}
}
I have a JMenu and I added a Actionlistener to to it but the Action listener doesn't do anything.
I am trying to make the mnExit menu exit the program (System.exit(0)), but the Actionlistener doesn't do anything.
Can anyone tell what I did wrong ?
import java.io.IOException;
public class Main {
private int a;
private Server s;
private Client c;
private JFrame j;
private static JTextField ipClient;
private static JTextField hostPort;
private static JTextField portClient;
private static JPasswordField passwordClient;
private static JPasswordField passwordHost;
/**
* #param args
* #wbp.parser.entryPoint
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Main start=new Main();
JFrame j=new JFrame("IControl");
j.setSize(new Dimension(448, 291));
j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
j.setSize(700,700);
j.getContentPane().setLayout(null);
JButton clientButton = new JButton("connect to server");
clientButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Client c=new Client("localhost","bbc");
}
});
clientButton.setBounds(32, 209, 154, 23);
j.getContentPane().add(clientButton);
JButton serverButton = new JButton("wait for connection");
serverButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Server s=new Server("abc");
}
});
serverButton.setBounds(278, 209, 154, 23);
j.getContentPane().add(serverButton);
ipClient = new JTextField();
ipClient.setBounds(67, 96, 123, 20);
j.getContentPane().add(ipClient);
ipClient.setColumns(10);
hostPort = new JTextField();
hostPort.setBounds(298, 130, 86, 20);
j.getContentPane().add(hostPort);
hostPort.setColumns(10);
JLabel lblIp = new JLabel("IP");
lblIp.setBounds(25, 99, 32, 14);
j.getContentPane().add(lblIp);
JLabel lblPort = new JLabel("port");
lblPort.setBounds(25, 133, 32, 14);
j.getContentPane().add(lblPort);
portClient = new JTextField();
portClient.setBounds(67, 130, 86, 20);
j.getContentPane().add(portClient);
portClient.setColumns(10);
passwordClient = new JPasswordField();
passwordClient.setBounds(67, 161, 86, 20);
j.getContentPane().add(passwordClient);
passwordHost = new JPasswordField();
passwordHost.setBounds(298, 161, 86, 20);
j.getContentPane().add(passwordHost);
JLabel lblPass = new JLabel("pass");
lblPass.setBounds(32, 158, 32, 14);
j.getContentPane().add(lblPass);
JMenuBar menuBar = new JMenuBar();
menuBar.setBounds(0, 0, 93, 21);
j.getContentPane().add(menuBar);
JMenu mnFile = new JMenu("File");
menuBar.add(mnFile);
JMenu mnExit = new JMenu("Exit");
mnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
mnFile.add(mnExit);
j.setVisible(true);
// j.pack();
}
/**
* #wbp.parser.entryPoint
*/
public Main()
{
}
}
you have to change code line from
JMenu mnExit = new JMenu("Exit");
to the
JMenuItem mnExit = new JMenuItem("Exit");
because you define JMenu instead of JMenuItem, but don't forget to create JMenu and then put there JMenuItem, more in the tutorial about JMenu / JMenuItem
the best option to use since jmenu doesn't trigger an action listener of its own is to use a mouse event on it instead. something like;
jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenuMouseClicked(evt);
}
......
private void jMenuMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
if(evt.getButton() == MouseEvent.BUTTON1)
System.out.println("good");
}