Created
May 8, 2019 19:13
-
-
Save avinashseth/348b91221ba6eb6b86d5ecb16c6850cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package guinow; | |
| import java.awt.*; | |
| import java.awt.event.*; | |
| import javax.swing.*; | |
| public class HomePage { | |
| HomePage() { | |
| JFrame jFrame = new JFrame("Title of Window"); | |
| JButton jButton = new JButton("Click Me"); | |
| JLabel jUsername = new JLabel("Username"); | |
| jUsername.setBounds(55, 50, 80, 20); | |
| jFrame.add(jUsername); | |
| JTextField jtUsername = new JTextField(); | |
| jtUsername.setBounds(55, 80, 80, 20); | |
| jFrame.add(jtUsername); | |
| JRadioButton jrb = new JRadioButton("Yes"); | |
| jrb.setBounds(55, 100, 20, 20); | |
| jFrame.add(jrb); | |
| // x y width height | |
| jButton.setBounds(130,100,100, 40); | |
| jFrame.add(jButton); | |
| jButton.addActionListener(new ActionListener() { | |
| @Override | |
| public void actionPerformed(ActionEvent e) { | |
| // TODO Auto-generated method stub | |
| JDialog jDialog = new JDialog(jFrame); | |
| jDialog.setTitle("(Dialog) You clicked on a button"); | |
| jDialog.setSize(300, 300); | |
| jDialog.show(); | |
| } | |
| }); | |
| // 400 x 500 | |
| jFrame.setSize(300,300); | |
| jFrame.setLayout(null); | |
| jFrame.setVisible(true); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment