java gui. overview the ”idea” the ”idea” the components the components listeners listeners...
Post on 13-Dec-2015
216 Views
Preview:
TRANSCRIPT
Java GUIJava GUI
OverviewOverview
The ”idea”The ”idea” The ComponentsThe Components ListenersListeners The ProgramThe Program Interface EventlistenerInterface Eventlistener My ExperiencesMy Experiences
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
The ComponentsThe Components
JTextAreaJTextArea JScrollPaneJScrollPane
JTextFieldJTextField JLabelJLabel JButtonJButton JSliderJSlider JCheckBoxJCheckBox
Interface EventListenerInterface EventListener
ListenersListeners
ActionListenerActionListener Buttons and CheckBoxButtons and CheckBox
ChangeListenerChangeListener SliderSlider
ItemListenerItemListener CheckBoxCheckBox
ActionListener (with timer)ActionListener (with timer)
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); } …} …
}}
The ProgramThe Program
You will now be shown the program You will now be shown the program in actionin action
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.
Thanks for Thanks for ”listening””listening”
top related