|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--SwingDemo
Create a JTextField and some JButtons to control it
| Constructor Summary | |
SwingDemo()
|
|
| Method Summary | |
void |
actionPerformed(ActionEvent e)
React to buttons that are pressed. |
protected JPanel |
makeButtonRow(String[] labels)
Return a JPanel that contains buttons with the specified
labels. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SwingDemo()
| Method Detail |
public void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenerprotected JPanel makeButtonRow(String[] labels)
JPanel that contains buttons with the specified
labels.
Reminder: you can call this method as follows:
makeButtonRow(new String[] {"red", "blue", "green", "black"});This method can be done as follows:
JPanel (call this ans)
that you will return at the end of this method
String array
JButton with
the appropriate label.
this class as an ActionListener
to the JButton
using addActionListener.
JButton to the ans JPanel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||