java gui. overview the ”idea” the ”idea” the components the components listeners listeners...

10
Java GUI Java GUI

Upload: jasmin-willis

Post on 13-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

Java GUIJava GUI

Page 2: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

OverviewOverview

The ”idea”The ”idea” The ComponentsThe Components ListenersListeners The ProgramThe Program Interface EventlistenerInterface Eventlistener My ExperiencesMy Experiences

Page 3: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

The ”idea”The ”idea”

Log which shows eventsLog which shows events The events are to influence a ballThe events are to influence a ball The ball itself is also to make The ball itself is also to make

changes to the guichanges to the gui

Page 4: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

The ComponentsThe Components

JTextAreaJTextArea JScrollPaneJScrollPane

JTextFieldJTextField JLabelJLabel JButtonJButton JSliderJSlider JCheckBoxJCheckBox

Page 5: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

Interface EventListenerInterface EventListener

Page 6: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

ListenersListeners

ActionListenerActionListener Buttons and CheckBoxButtons and CheckBox

ChangeListenerChangeListener SliderSlider

ItemListenerItemListener CheckBoxCheckBox

ActionListener (with timer)ActionListener (with timer)

Page 7: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

ActionListenerActionListener

closeButtoncloseButton.addActionListener(new .addActionListener(new Event());Event());

privateprivate classclass Event Event implementsimplements ActionListener {ActionListener { publicpublic voidvoid actionPerformed(ActionEvent actionPerformed(ActionEvent

e) {e) { Object source = e.getSource();Object source = e.getSource(); ifif(source == (source == closeButtoncloseButton) {) {

System.System.exitexit(0);(0); } …} …

}}

Page 8: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

The ProgramThe Program

You will now be shown the program You will now be shown the program in actionin action

Page 9: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

My ExperiencesMy Experiences

Not hard to work withNot hard to work with Quite straight forwardQuite straight forward If you can’t find the method you are If you can’t find the method you are

looking for you are using the wrong looking for you are using the wrong component.component.

Page 10: Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener

Thanks for Thanks for ”listening””listening”