/** * Adds a group of checkboxs using a grid layout. * * @param rows the number of rows * @param columns the number of columns * @param labels the labels * @param defaultValues the initial states * @param headings the column headings Example: * http://imagej.nih.gov/ij/plugins/multi-column-dialog/index.html */ public void addCheckboxGroup( int rows, int columns, String[] labels, boolean[] defaultValues, String[] headings) { Panel panel = new Panel(); int nRows = headings != null ? rows + 1 : rows; panel.setLayout(new GridLayout(nRows, columns, 6, 0)); int startCBIndex = cbIndex; if (checkbox == null) checkbox = new Vector(12); if (headings != null) { Font font = new Font("SansSerif", Font.BOLD, 12); for (int i = 0; i < columns; i++) { if (i > headings.length - 1 || headings[i] == null) panel.add(new Label("")); else { Label label = new Label(headings[i]); label.setFont(font); panel.add(label); } } } int i1 = 0; int[] index = new int[labels.length]; for (int row = 0; row < rows; row++) { for (int col = 0; col < columns; col++) { int i2 = col * rows + row; if (i2 >= labels.length) break; index[i1] = i2; String label = labels[i1]; if (label == null || label.length() == 0) { Label lbl = new Label(""); panel.add(lbl); i1++; continue; } if (label.indexOf('_') != -1) label = label.replace('_', ' '); Checkbox cb = new Checkbox(label); checkbox.addElement(cb); cb.setState(defaultValues[i1]); cb.addItemListener(this); if (Recorder.record || macro) saveLabel(cb, labels[i1]); if (IJ.isLinux()) { Panel panel2 = new Panel(); panel2.setLayout(new BorderLayout()); panel2.add("West", cb); panel.add(panel2); } else panel.add(cb); i1++; } } c.gridx = 0; c.gridy = y; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; c.insets = getInsets(10, 0, 0, 0); grid.setConstraints(panel, c); add(panel); y++; }
/** Method declaration */ private void initGUI() { Panel pQuery = new Panel(); Panel pCommand = new Panel(); pResult = new Panel(); pQuery.setLayout(new BorderLayout()); pCommand.setLayout(new BorderLayout()); pResult.setLayout(new BorderLayout()); Font fFont = new Font("Dialog", Font.PLAIN, 12); txtCommand = new TextArea(5, 40); txtCommand.addKeyListener(this); txtResult = new TextArea(20, 40); txtCommand.setFont(fFont); txtResult.setFont(new Font("Courier", Font.PLAIN, 12)); butExecute = new Button("Execute"); butClear = new Button("Clear"); butExecute.addActionListener(this); butClear.addActionListener(this); pCommand.add("East", butExecute); pCommand.add("West", butClear); pCommand.add("Center", txtCommand); gResult = new Grid(); setLayout(new BorderLayout()); pResult.add("Center", gResult); pQuery.add("North", pCommand); pQuery.add("Center", pResult); fMain.add("Center", pQuery); tTree = new Tree(); // (ulrivo): screen with less than 640 width Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); if (d.width >= 640) { tTree.setMinimumSize(new Dimension(200, 100)); } else { tTree.setMinimumSize(new Dimension(80, 100)); } gResult.setMinimumSize(new Dimension(200, 300)); fMain.add("West", tTree); doLayout(); fMain.pack(); }
public void init(GUI gui) { m_gui = gui; // Create the display // width, height addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } }); setSize(new Dimension(100, 100)); setBackground(Color.white); setFont(new Font("Helvetica", Font.PLAIN, 14)); GridBagLayout gridbag = new GridBagLayout(); setLayout(gridbag); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; recency = new TextField(Truline.userProps.getProperty("RecencyDays", "28"), 5); setRow(c, gridbag, new Label("Recency Days"), recency); maxdays = new TextField(Truline.userProps.getProperty("MaxDays", "120"), 5); setRow(c, gridbag, new Label("Max Days"), maxdays); maxvariant = new TextField(Truline.userProps.getProperty("MaxVariant", "25"), 5); setRow(c, gridbag, new Label("Max Variant"), maxvariant); maiden = new TextField(Truline.userProps.getProperty("UseMaiden", "Y"), 2); setRow(c, gridbag, new Label("Use Maiden"), maiden); betFactorVersion = new TextField(Truline.userProps.getProperty("BetFactorVersion", " "), 7); setRow(c, gridbag, new Label("Bet Factor Version"), betFactorVersion); datadir = new TextField(Truline.userProps.getProperty("DATADIR", "."), 40); setRow(c, gridbag, new Label("Data Directory"), datadir); fontsize = new TextField(Truline.userProps.getProperty("FontSize", "8"), 40); setRow(c, gridbag, new Label("Print Font Size (8,9,10)"), fontsize); printProgram = new TextField(Truline.userProps.getProperty("PrintProgram", "WordPad.exe /p"), 40); setRow(c, gridbag, new Label("Print program"), printProgram); // shell = new TextField(Truline.userProps.getProperty("Shell", "command"), // 40); // setRow(c, gridbag, new Label("Shell program"), shell); Panel panel1 = new Panel(); panel1.setLayout(new BorderLayout()); Button OKButton = new Button(" OK "); OKButton.setActionCommand("ok"); OKButton.addActionListener(this); panel1.add(OKButton, BorderLayout.CENTER); Panel panel2 = new Panel(); panel2.setLayout(new BorderLayout()); Button cancelButton = new Button("Cancel"); cancelButton.setActionCommand("cancel"); cancelButton.addActionListener(this); panel2.add(cancelButton, BorderLayout.CENTER); setRow(c, gridbag, panel2, panel1); pack(); show(); }
private void updateDebugPanelState(String result, boolean debug, boolean test) { result = result == null ? "nothing" : result; List<Component> componentList = Arrays.asList(getComponents()); if (!componentList.contains(p_debug)) { choice = new Label(String.format("Your choice is: %s", result)); isDebug = new Label(String.format("Debug mode: %b", debug)); isTest = new Label(String.format("Test mode: %b", test)); GridBagLayout layout = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); layout.setConstraints(choice, constraints); constraints.gridy = 1; layout.setConstraints(isDebug, constraints); constraints.gridy = 2; layout.setConstraints(isTest, constraints); p_debug.setLayout(layout); p_debug.add(choice); p_debug.add(isDebug); p_debug.add(isTest); add(p_debug, BorderLayout.SOUTH); } else { choice.setText(String.format("Your choice is: %s", result)); isDebug.setText(String.format("Debug mode: %b", debug)); isTest.setText(String.format("Test mode: %b", test)); } }
/** * Adds a radio button group. * * @param label group label (or null) * @param items radio button labels * @param rows number of rows * @param columns number of columns * @param defaultItem button initially selected */ public void addRadioButtonGroup( String label, String[] items, int rows, int columns, String defaultItem) { Panel panel = new Panel(); int n = items.length; panel.setLayout(new GridLayout(rows, columns, 0, 0)); CheckboxGroup cg = new CheckboxGroup(); for (int i = 0; i < n; i++) { Checkbox cb = new Checkbox(items[i], cg, items[i].equals(defaultItem)); cb.addItemListener(this); panel.add(cb); } if (radioButtonGroups == null) radioButtonGroups = new Vector(); radioButtonGroups.addElement(cg); Insets insets = getInsets(5, 10, 0, 0); if (label == null || label.equals("")) { label = "rbg" + radioButtonGroups.size(); insets.top += 5; } else { setInsets(10, insets.left, 0); addMessage(label); insets.top = 2; insets.left += 10; } c.gridx = 0; c.gridy = y; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(insets.top, insets.left, 0, 0); grid.setConstraints(panel, c); add(panel); if (Recorder.record || macro) saveLabel(cg, label); y++; }
public void buildChooser() { Panel panel = new Panel(); panel.setLayout(new GridLayout()); for (int i = 1; i <= 3; i++) { for (int x = 1; x <= 2; x++) { panel.add(addButton(i * x + "", Color.yellow)); } } add(panel); }
/** * Adds a numeric field. The first word of the label must be unique or command recording will not * work. * * @param label the label * @param defaultValue value to be initially displayed * @param digits number of digits to right of decimal point * @param columns width of field in characters * @param units a string displayed to the right of the field */ public void addNumericField( String label, double defaultValue, int digits, int columns, String units) { String label2 = label; if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' '); Label theLabel = makeLabel(label2); c.gridx = 0; c.gridy = y; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; if (firstNumericField) c.insets = getInsets(5, 0, 3, 0); else c.insets = getInsets(0, 0, 3, 0); grid.setConstraints(theLabel, c); add(theLabel); if (numberField == null) { numberField = new Vector(5); defaultValues = new Vector(5); defaultText = new Vector(5); } if (IJ.isWindows()) columns -= 2; if (columns < 1) columns = 1; String defaultString = IJ.d2s(defaultValue, digits); if (Double.isNaN(defaultValue)) defaultString = ""; TextField tf = new TextField(defaultString, columns); if (IJ.isLinux()) tf.setBackground(Color.white); tf.addActionListener(this); tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); numberField.addElement(tf); defaultValues.addElement(new Double(defaultValue)); defaultText.addElement(tf.getText()); c.gridx = 1; c.gridy = y; c.anchor = GridBagConstraints.WEST; tf.setEditable(true); // if (firstNumericField) tf.selectAll(); firstNumericField = false; if (units == null || units.equals("")) { grid.setConstraints(tf, c); add(tf); } else { Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(tf); panel.add(new Label(" " + units)); grid.setConstraints(panel, c); add(panel); } if (Recorder.record || macro) saveLabel(tf, label); y++; }
public Notebook(int tabsPostion, int tabsStyle) { pages = new Vector(); setTabsInfo(tabsPostion, tabsStyle); fReg = new Font("Helvetica", Font.PLAIN, 12); fSel = new Font("Helvetica", Font.BOLD, 12); setLayout(this); dbLeft = new Button("<<"); dbRight = new Button(">>"); add(dbLeft); add(dbRight); oobj = new Panel(); oobj.setLayout(card = new CardLayout()); add(oobj); nullPoly = new Polygon(); nullPoly.addPoint(0, 0); nullPoly.addPoint(1, 1); nullPoly.addPoint(0, 0); iTabsStyle = TOP; }
/** * If 'applet' is not null, creates a new ImageJ frame that runs as an applet. If 'mode' is * ImageJ.EMBEDDED and 'applet is null, creates an embedded (non-standalone) version of ImageJ. */ public ImageJ(java.applet.Applet applet, int mode) { super("ImageJ"); if ((mode & DEBUG) != 0) IJ.setDebugMode(true); mode = mode & 255; if (IJ.debugMode) IJ.log("ImageJ starting in debug mode: " + mode); embedded = applet == null && (mode == EMBEDDED || mode == NO_SHOW); this.applet = applet; String err1 = Prefs.load(this, applet); setBackground(backgroundColor); Menus m = new Menus(this, applet); String err2 = m.addMenuBar(); m.installPopupMenu(this); setLayout(new BorderLayout()); // Tool bar toolbar = new Toolbar(); toolbar.addKeyListener(this); add("Center", toolbar); // Status bar statusBar = new Panel(); statusBar.setLayout(new BorderLayout()); statusBar.setForeground(Color.black); statusBar.setBackground(backgroundColor); statusLine = new JLabel(); statusLine.setFont(new Font("SansSerif", Font.PLAIN, 13)); statusLine.addKeyListener(this); statusLine.addMouseListener(this); statusBar.add("Center", statusLine); progressBar = new ProgressBar(120, 20); progressBar.addKeyListener(this); progressBar.addMouseListener(this); statusBar.add("East", progressBar); add("South", statusBar); IJ.init(this, applet); addKeyListener(this); addWindowListener(this); setFocusTraversalKeysEnabled(false); m.installStartupMacroSet(); // add custom tools runStartupMacro(); Point loc = getPreferredLocation(); Dimension tbSize = toolbar.getPreferredSize(); setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug if (mode != NO_SHOW) { if (IJ.isWindows()) try { setIcon(); } catch (Exception e) { } setLocation(loc.x, loc.y); setResizable(!IJ.isMacOSX()); pack(); setVisible(true); } if (err1 != null) IJ.error(err1); if (err2 != null) { IJ.error(err2); IJ.runPlugIn("ij.plugin.ClassChecker", ""); } if (IJ.isMacintosh() && applet == null) { Object qh = null; qh = IJ.runPlugIn("MacAdapter", ""); if (qh == null) IJ.runPlugIn("QuitHandler", ""); } if (applet == null) IJ.runPlugIn("ij.plugin.DragAndDrop", ""); String str = m.getMacroCount() == 1 ? " macro" : " macros"; IJ.showStatus(version() + m.getPluginCount() + " commands; " + m.getMacroCount() + str); configureProxy(); if (applet == null) loadCursors(); }
public NslDimValue( NslFrame nsl_display_frame, String var_sel_full_name, NslVariableInfo var_sel_info, String plot_type_name, boolean replace_canvas) { super(nsl_display_frame, "Enter Values", true); /* these variables are needed in the action method */ this.nsl_display_frame = nsl_display_frame; this.var_sel_full_name = var_sel_full_name; this.var_sel_info = var_sel_info; this.plot_type_name = plot_type_name; this.replace_canvas = replace_canvas; num_dims = (var_sel_info.getCountDimensions()); if ((num_dims == 0) || (num_dims == 1) || (num_dims == 2) || (num_dims >= 4)) { System.err.println("Error: NslDimValue: should not have gotten here in the code."); return; } Panel p = new Panel(); if (num_dims == 3) { if (NslDimInput.dim_choice.equals("HI")) { addEnterOneValue(p, "J"); } else if (NslDimInput.dim_choice.equals("HJ")) { addEnterOneValue(p, "I"); } else if (NslDimInput.dim_choice.equals("IJ")) { addEnterOneValue(p, "H"); } else { System.err.println("Error: NslDimVal: bad input choice."); dispose(); return; } } // end if (num_dims==3) else if (num_dims == 4) { if (NslDimInput.dim_choice.equals("GH")) { addEnterTwoValues(p, "I", "J"); } else if (NslDimInput.dim_choice.equals("GI")) { addEnterTwoValues(p, "H", "J"); } else if (NslDimInput.dim_choice.equals("GJ")) { addEnterTwoValues(p, "H", "I"); } else if (NslDimInput.dim_choice.equals("HI")) { addEnterTwoValues(p, "G", "J"); } else if (NslDimInput.dim_choice.equals("HJ")) { addEnterTwoValues(p, "G", "I"); } else if (NslDimInput.dim_choice.equals("IJ")) { addEnterTwoValues(p, "G", "H"); } else { System.err.println("Error: NslDimVal:bad input choice"); dispose(); return; } } // end if (num_dims==4) add("Center", p); Button b; Panel p4 = new Panel(); p4.setLayout(new GridLayout(1, 5)); p4.add(b = new Button("<Back")); b.addActionListener(this); p4.add(new Label("")); p4.add(b = new Button("Cancel")); b.addActionListener(this); p4.add(new Label("")); p4.add(b = new Button("Next>")); b.addActionListener(this); add("South", p4); setSize(450, 180); } // end constructor
/** * If 'applet' is not null, creates a new ImageJ frame that runs as an applet. If 'mode' is * ImageJ.EMBEDDED and 'applet is null, creates an embedded (non-standalone) version of ImageJ. */ public ImageJ(java.applet.Applet applet, int mode) { super("ImageJ"); embedded = applet == null && (mode == EMBEDDED || mode == NO_SHOW); this.applet = applet; String err1 = Prefs.load(this, applet); if (IJ.isLinux()) { backgroundColor = new Color(240, 240, 240); setBackground(backgroundColor); } Menus m = new Menus(this, applet); String err2 = m.addMenuBar(); m.installPopupMenu(this); setLayout(new GridLayout(2, 1)); // Tool bar toolbar = new Toolbar(); toolbar.addKeyListener(this); add(toolbar); // Status bar statusBar = new Panel(); statusBar.setLayout(new BorderLayout()); statusBar.setForeground(Color.black); statusBar.setBackground(backgroundColor); statusLine = new Label(); statusLine.setFont(SansSerif12); statusLine.addKeyListener(this); statusLine.addMouseListener(this); statusBar.add("Center", statusLine); progressBar = new ProgressBar(120, 20); progressBar.addKeyListener(this); progressBar.addMouseListener(this); statusBar.add("East", progressBar); statusBar.setSize(toolbar.getPreferredSize()); add(statusBar); IJ.init(this, applet); addKeyListener(this); addWindowListener(this); setFocusTraversalKeysEnabled(false); Point loc = getPreferredLocation(); Dimension tbSize = toolbar.getPreferredSize(); int ijWidth = tbSize.width + 10; int ijHeight = 100; setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug if (mode != NO_SHOW) { if (IJ.isWindows()) try { setIcon(); } catch (Exception e) { } setBounds(loc.x, loc.y, ijWidth, ijHeight); // needed for pack to work setLocation(loc.x, loc.y); pack(); setResizable(!(IJ.isMacintosh() || IJ.isWindows())); // make resizable on Linux show(); } if (err1 != null) IJ.error(err1); if (err2 != null) { IJ.error(err2); IJ.runPlugIn("ij.plugin.ClassChecker", ""); } m.installStartupMacroSet(); if (IJ.isMacintosh() && applet == null) { Object qh = null; qh = IJ.runPlugIn("MacAdapter", ""); if (qh == null) IJ.runPlugIn("QuitHandler", ""); } if (applet == null) IJ.runPlugIn("ij.plugin.DragAndDrop", ""); String str = m.getMacroCount() == 1 ? " macro" : " macros"; IJ.showStatus(version() + m.getPluginCount() + " commands; " + m.getMacroCount() + str); // if (applet==null && !embedded && Prefs.runSocketListener) // new SocketListener(); configureProxy(); if (applet == null) loadCursors(); }
/** * Adds a slider (scroll bar) to the dialog box. Floating point values will be used if * (maxValue-minValue)<=5.0 and either minValue or maxValue are non-integer. * * @param label the label * @param minValue the minimum value of the slider * @param maxValue the maximum value of the slider * @param defaultValue the initial value of the slider */ public void addSlider(String label, double minValue, double maxValue, double defaultValue) { if (defaultValue < minValue) defaultValue = minValue; if (defaultValue > maxValue) defaultValue = maxValue; int columns = 4; int digits = 0; double scale = 1.0; if ((maxValue - minValue) <= 5.0 && (minValue != (int) minValue || maxValue != (int) maxValue || defaultValue != (int) defaultValue)) { scale = 20.0; minValue *= scale; maxValue *= scale; defaultValue *= scale; digits = 2; } String label2 = label; if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' '); Label theLabel = makeLabel(label2); c.gridx = 0; c.gridy = y; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.insets = new Insets(0, 0, 3, 0); grid.setConstraints(theLabel, c); add(theLabel); if (slider == null) { slider = new Vector(5); sliderIndexes = new int[MAX_SLIDERS]; sliderScales = new double[MAX_SLIDERS]; } Scrollbar s = new Scrollbar( Scrollbar.HORIZONTAL, (int) defaultValue, 1, (int) minValue, (int) maxValue + 1); GUI.fix(s); slider.addElement(s); s.addAdjustmentListener(this); s.setUnitIncrement(1); if (numberField == null) { numberField = new Vector(5); defaultValues = new Vector(5); defaultText = new Vector(5); } if (IJ.isWindows()) columns -= 2; if (columns < 1) columns = 1; TextField tf = new TextField(IJ.d2s(defaultValue / scale, digits), columns); if (IJ.isLinux()) tf.setBackground(Color.white); tf.addActionListener(this); tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); numberField.addElement(tf); sliderIndexes[slider.size() - 1] = numberField.size() - 1; sliderScales[slider.size() - 1] = scale; defaultValues.addElement(new Double(defaultValue / scale)); defaultText.addElement(tf.getText()); tf.setEditable(true); firstSlider = false; Panel panel = new Panel(); GridBagLayout pgrid = new GridBagLayout(); GridBagConstraints pc = new GridBagConstraints(); panel.setLayout(pgrid); pc.gridx = 0; pc.gridy = 0; pc.gridwidth = 1; pc.ipadx = 85; pc.anchor = GridBagConstraints.WEST; pgrid.setConstraints(s, pc); panel.add(s); pc.ipadx = 0; // reset // text field pc.gridx = 1; pc.insets = new Insets(5, 5, 0, 0); pc.anchor = GridBagConstraints.EAST; pgrid.setConstraints(tf, pc); panel.add(tf); grid.setConstraints(panel, c); c.gridx = 1; c.gridy = y; c.gridwidth = 1; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 0, 0, 0); grid.setConstraints(panel, c); add(panel); y++; if (Recorder.record || macro) saveLabel(tf, label); }
/** Displays this dialog box. */ public void showDialog() { if (macro) { dispose(); recorderOn = Recorder.record && Recorder.recordInMacros; } else { if (pfr != null) // prepare preview (not in macro mode): tell the PlugInFilterRunner to listen pfr.setDialog(this); Panel buttons = new Panel(); buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); cancel = new Button(cancelLabel); cancel.addActionListener(this); cancel.addKeyListener(this); if (yesNoCancel) { okLabel = yesLabel; no = new Button(noLabel); no.addActionListener(this); no.addKeyListener(this); } okay = new Button(okLabel); okay.addActionListener(this); okay.addKeyListener(this); boolean addHelp = helpURL != null; if (addHelp) { help = new Button(helpLabel); help.addActionListener(this); help.addKeyListener(this); } if (IJ.isMacintosh()) { if (addHelp) buttons.add(help); if (yesNoCancel) buttons.add(no); if (!hideCancelButton) buttons.add(cancel); buttons.add(okay); } else { buttons.add(okay); if (yesNoCancel) buttons.add(no); ; if (!hideCancelButton) buttons.add(cancel); if (addHelp) buttons.add(help); } c.gridx = 0; c.gridy = y; c.anchor = GridBagConstraints.EAST; c.gridwidth = 2; c.insets = new Insets(15, 0, 0, 0); grid.setConstraints(buttons, c); add(buttons); if (IJ.isMacintosh()) setResizable(false); pack(); setup(); if (centerDialog) GUI.center(this); setVisible(true); recorderOn = Recorder.record; IJ.wait(50); // work around for Sun/WinNT bug } /* For plugins that read their input only via dialogItemChanged, call it at least once */ if (!wasCanceled && dialogListeners != null && dialogListeners.size() > 0) { resetCounters(); ((DialogListener) dialogListeners.elementAt(0)).dialogItemChanged(this, null); recorderOn = false; } resetCounters(); }
/** * Handles when aides cover each other. They must tell * us who they're covering so that that poor person * doesn't get a missed shift. This of course means i * have to work on MyHours some more... If they select * a valid userid to cover for makes the appropriate * entry in AIDELOG. * * @param An SaoWorker who is covering someone else */ public void WhoRUCovering(final SaoWorker w) { int i = 0; int h = bd.getHours(); int m = bd.getMinutes(); if (((m >= 20) && (m < 30)) || ((m >= 50) && (m < 60))) { if (m < 30) { m = m + 10; } else { m = m + 10 - 60; h = h + 1; } } int dopp = bd.getDoPP(); if (dopp > 7) { dopp = dopp - 7; } String slotid = bd.getSlot(h, m, dopp); String q = "select * from AIDESCHED where " + slotid + "=1"; final String[] userids = {"", "", "", "", "", "", "", "", "", ""}; final BatSQL bSQL = new BatSQL(); ResultSet rs = bSQL.query(q); try { boolean more = rs.next(); if (more) //because there might be only one person for this slot { while (more) { userids[i] = rs.getString(1); i++; more = rs.next(); } } //end of if more } //end of try catch (SQLException ex) { System.out.println("!*******SQLException caught*******!"); System.out.println("WhoRUCovering"); while (ex != null) { System.out.println ("SQLState: " + ex.getSQLState ()); System.out.println ("Message: " + ex.getMessage ()); System.out.println ("Vendor: " + ex.getErrorCode ()); ex = ex.getNextException (); System.out.println (""); } System.exit(0); } //end catching SQLExceptions catch (java.lang.Exception ex) { System.out.println("!*******Exception caught*******!"); System.out.println("WhoRUCovering"); System.exit(0); } //end catching other Exceptions final Frame coverF = new Frame("Covering?"); final Panel p = new Panel(); final Panel btnP = new Panel(); final List coverL = new List(); Button ok = new Button("Cover"); Button nok = new Button("Cancel"); final int i2 = i; ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String id = coverL.getSelectedItem(); BatSQL bS = new BatSQL(); String a = "insert into aidelog values ('C', \"" + id + "\", \"" + bd.getDate() + "\", " + bd.getStringHours() + bd.getStringMinutes() + ", 'I')"; bS.update(a); a = "update AIDEDIN set COVERING='" + id + "' where USERID='" + w.getUserID() + "'"; bS.update(a); bS.disconnect(); coverF.dispose(); } }); nok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { coverF.dispose(); } }); btnP.setLayout(new FlowLayout()); btnP.add(ok); btnP.add(nok); p.setLayout(new BorderLayout()); p.add(new Label("Who are you covering for?"), BorderLayout.NORTH); int j; for (j = 0; j <= i; j++) { coverL.add(userids[j]); } p.add(coverL, BorderLayout.CENTER); p.add(btnP, BorderLayout.SOUTH); coverL.select(0); coverF.setLayout(new FlowLayout()); coverF.add(p); coverF.pack(); coverF.setLocation(200, 200); coverF.show(); } //end of WhoRUCovering