tutorial for project part 2 gui in java n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Tutorial for Project (Part 2) (GUI in Java) PowerPoint Presentation
Download Presentation
Tutorial for Project (Part 2) (GUI in Java)

Loading in 2 Seconds...

play fullscreen
1 / 16

Tutorial for Project (Part 2) (GUI in Java) - PowerPoint PPT Presentation


  • 88 Views
  • Uploaded on

Tutorial for Project (Part 2) (GUI in Java). TA : Seunghan Chang ( aq9320@wayne.edu ). Example GUI in Java(1). 4. JLabel. 1. JFame. 2. JPanel. 3. JMenu. 5. JTextField. 6. JButton. Example GUI in Java(2). Please click me to see how this GUI works. Programming Environments. JFrame.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Tutorial for Project (Part 2) (GUI in Java)' - jillian-erickson


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
tutorial for project part 2 gui in java

Tutorial for Project (Part 2)(GUI in Java)

TA : Seunghan Chang

(aq9320@wayne.edu)

slide3

4. JLabel

1. JFame

2. JPanel

3. JMenu

5. JTextField

6. JButton

Example GUI in Java(2)

Please click me to see how this GUI works

slide5

JFrame

sampleFrame = new MainFrame();

sampleFrame.addWindowListener(

new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{System.exit(0); }});

. . .

sampleFrame.show();

class MainFrame extends JFrame {

public MainFrame() {

Toolkit kit = Toolkit.getDefaultToolkit();

Dimension screenSize = kit.getScreenSize();

int h = screenSize.height;

int w = screenSize.width;

setSize(w-100,h-100);

setLocation(10, 10);

setTitle("Sample Frame"); }

slide6

Example GUI in Java

4. JLabel

1. JFame

2. JPanel

3. JMenu

5. JTextField

6. JButton

slide7

JPanel : Conference

JPanel conferencePanel = new JPanel();

conferencePanel.setLayout(new GridLayout(2,4));

conferencePanel.setBorder(BorderFactory.createLineBorder(Color.blue, 2));

conferencePanel.setBorder(BorderFactory.createTitledBorder("Conference"));

JPanel publicationPanel_2 = new JPanel();

publicationPanel_2.setLayout(new FlowLayout(FlowLayout.LEFT));

publicationPanel.add(publicationPanel_2);

Container contentPane = sampleFrame.getContentPane();contentPane.setLayout(new GridLayout(6,1));

contentPane.add(titlePanel);

contentPane.add(conferencePanel);

contentPane.add(proceedingsPanel);

contentPane.add(publicationPanel);

contentPane.add(emptyPanel);

contentPane.add(buttonPanel);

Layout Manager

slide8

Example GUI in Java

4. JLabel

1. JFame

2. JPanel

3. JMenu

5. JTextField

6. JButton

slide9

JMenu

JMenuBar menuBar = new JMenuBar();

sampleFrame.setJMenuBar(menuBar);

JMenu samplemenu1 = new JMenu("Menu1");

samplemenu1.setMnemonic('1');

. . .

menuBar.add(samplemenu1);

. . .

Action menu1Action = new AbstractAction("Menu1")

{public void actionPerformed(ActionEvent e)

{JOptionPane.showMessageDialog(sampleFrame, "You selected Menu1", "Menu1",

JOptionPane.INFORMATION_MESSAGE);}};

menu1Action.putValue(Action.MNEMONIC_KEY, new Integer('1'));

samplemenu1.add(menu1Action);

slide10

Example GUI in Java

4. JLabel

1. JFame

2. JPanel

3. JMenu

5. JTextField

6. JButton

slide11

JLabel

JLabel titleLabel = new JLabel();

titleLabel.setHorizontalTextPosition(JLabel. CENTER);

titleLabel.setText("Conference Publication Insertion");

Font f = new Font("Arial", Font.BOLD, 30);

titleLabel.setForeground(Color.blue);

titleLabel.setFont(f);

titlePanel.add(titleLabel);

slide12

Example GUI in Java

4. JLabel

1. JFame

2. JPanel

3. JMenu

5. JTextField

6. JButton

slide13

JTextField

private static JTextField sampleJTextField_12 = null;

sampleJTextField_12 = new JTextField(70);

publicationPanel_2.add(sampleJTextField_12);

slide14

Example GUI in Java

4. JLabel

1. JFame

2. JPanel

3. JMenu

5. JTextField

6. JButton

slide15

JButton

private static JButton sampleJButton1 = null;

JButton sampleJButton1 = new JButton("Insert");

buttonPanel.add(sampleJButton1);

sampleJButton1.addActionListener(new ActionListener()

{public void actionPerformed(ActionEvent e)

{JOptionPane.showMessageDialog(sampleFrame, "You selected Insert Button", "Insert",

JOptionPane.INFORMATION_MESSAGE);}});

slide16

For More Useful Information

http://java.sun.com/docs/books/tutorial/ui/features/components.html

http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComponent.html

Thanks and Good Luck