protected JPanel createForm() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); // Time JPanel pT = new JPanel(new FlowLayout()); pT.setBorder(BorderFactory.createTitledBorder("Start Time")); hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myrow.getTime()), 0, 99, 1)); hh.setEditor(new JSpinner.NumberEditor(hh, "00")); pT.add(hh); pT.add(new JLabel("h ")); mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myrow.getTime()), 0, 59, 1)); mm.setEditor(new JSpinner.NumberEditor(mm, "00")); pT.add(mm); pT.add(new JLabel("m ")); ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myrow.getTime()), 0, 59, 1)); ss.setEditor(new JSpinner.NumberEditor(ss, "00")); pT.add(ss); pT.add(new JLabel("s")); panel.add(pT); // Green JPanel pG = new JPanel(new BorderLayout()); pG.setBorder(BorderFactory.createTitledBorder("Green (sec.)")); green = new JSpinner(new SpinnerNumberModel(myrow.getGreen() * conversion, 0.0, 99999.99, 1)); green.setEditor(new JSpinner.NumberEditor(green, "####0.##")); pG.add(green); panel.add(pG); // Red JPanel pR = new JPanel(new BorderLayout()); pR.setBorder(BorderFactory.createTitledBorder("Red (sec.)")); red = new JSpinner(new SpinnerNumberModel(myrow.getRed() * conversion, 0.0, 99999.99, 1)); red.setEditor(new JSpinner.NumberEditor(red, "####0.##")); pR.add(red); panel.add(pR); JPanel bp = new JPanel(new FlowLayout()); JButton bOK = new JButton(" OK "); bOK.setActionCommand(cmdOK); bOK.addActionListener(new ButtonEventsListener()); JButton bCancel = new JButton("Cancel"); bCancel.setActionCommand(cmdCancel); bCancel.addActionListener(new ButtonEventsListener()); bp.add(bOK); bp.add(bCancel); panel.add(bp); return panel; }
public void addrow(CycleDataRow x) { boolean done = false; for (int i = 0; i < cycledata.size(); i++) { if (cycledata.get(i).getTime() > x.getTime()) { cycledata.insertElementAt(x, i); done = true; break; } } if (!done) cycledata.add(x); fireTableStructureChanged(); }