Line | |
---|
1 | package org.expeditee.items.widgets;
|
---|
2 |
|
---|
3 | import javax.swing.JComboBox;
|
---|
4 |
|
---|
5 | import org.expeditee.items.Text;
|
---|
6 |
|
---|
7 | public class SampleWidget1 extends DataFrameWidget {
|
---|
8 |
|
---|
9 | static String testItems[] = new String[] { "dog", "fish", "cat", "pig" };
|
---|
10 |
|
---|
11 | private JComboBox _combo;
|
---|
12 |
|
---|
13 | public SampleWidget1(Text source, String[] args) {
|
---|
14 | super(source, new JComboBox(testItems), 200, 200, 50, 50);
|
---|
15 | _combo = (JComboBox) super._swingComponent;
|
---|
16 | }
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | protected String[] getArgs() {
|
---|
20 | String[] stateArgs = new String[1];
|
---|
21 | stateArgs[0] = Integer.toString(_combo.getSelectedIndex());
|
---|
22 | return stateArgs;
|
---|
23 | }
|
---|
24 |
|
---|
25 | /** TODO: REVISE
|
---|
26 | @Override
|
---|
27 | public void refresh() {
|
---|
28 | super.refresh();
|
---|
29 | Frame frame = getDataFrame();
|
---|
30 | if(frame != null) {
|
---|
31 | _combo.removeAllItems();
|
---|
32 | for(Text text: frame.getBodyTextItems(false)) {
|
---|
33 | _combo.addItem(text.getText());
|
---|
34 | }
|
---|
35 | _combo.setSelectedIndex(0);
|
---|
36 | }
|
---|
37 | }
|
---|
38 | */
|
---|
39 |
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.