protected JComponent createNorthPanel() { class MyTextField extends JTextField { public MyTextField() { super(""); } public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); return new Dimension(200, d.height); } } JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(4, 0, 8, 8); gbConstraints.fill = GridBagConstraints.VERTICAL; gbConstraints.weightx = 0; gbConstraints.weighty = 1; gbConstraints.anchor = GridBagConstraints.EAST; JLabel label = new JLabel(IdeBundle.message("editbox.line.number")); panel.add(label, gbConstraints); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weightx = 1; myField = new MyTextField(); panel.add(myField, gbConstraints); myField.setToolTipText(IdeBundle.message("tooltip.syntax.linenumber.columnnumber")); LogicalPosition position = myEditor.getCaretModel().getLogicalPosition(); myField.setText(String.format("%d:%d", position.line + 1, position.column + 1)); if (isInternal()) { gbConstraints.gridy = 1; gbConstraints.weightx = 0; gbConstraints.weighty = 1; gbConstraints.anchor = GridBagConstraints.EAST; final JLabel offsetLabel = new JLabel("Offset:"); panel.add(offsetLabel, gbConstraints); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weightx = 1; myOffsetField = new MyTextField(); panel.add(myOffsetField, gbConstraints); myOffsetField.setToolTipText(String.valueOf(myEditor.getCaretModel().getOffset())); } return panel; }
@Override public JComponent createUI( DescriptionType inputOrOutput, Map<URI, Object> dataMap, Orientation orientation) { // Create the main panel JComponent component = new JPanel(new MigLayout("fill")); boolean isOptional = false; if (inputOrOutput instanceof InputDescriptionType) { isOptional = ((InputDescriptionType) inputOrOutput).getMinOccurs().equals(new BigInteger("0")); } // Display the SourceCA into a JTextField JTextField jtf = new JTextField(); jtf.setToolTipText(inputOrOutput.getAbstract().get(0).getValue()); // "Save" the CA inside the JTextField jtf.getDocument().putProperty(DATA_MAP_PROPERTY, dataMap); URI uri = URI.create(inputOrOutput.getIdentifier().getValue()); jtf.getDocument().putProperty(URI_PROPERTY, uri); // add the listener for the text changes in the JTextField jtf.getDocument() .addDocumentListener( EventHandler.create(DocumentListener.class, this, "saveDocumentText", "document")); if (isOptional) { if (dataMap.containsKey(uri)) { jtf.setText(dataMap.get(uri).toString()); } } GeometryData geometryData = null; if (inputOrOutput instanceof InputDescriptionType) { geometryData = (GeometryData) ((InputDescriptionType) inputOrOutput).getDataDescription().getValue(); } // If the DescriptionType is an output, there is nothing to show, so exit if (geometryData == null) { return null; } component.add(jtf, "growx"); if (orientation.equals(Orientation.VERTICAL)) { JPanel buttonPanel = new JPanel(new MigLayout()); // Create the button Browse JButton pasteButton = new JButton(ToolBoxIcon.getIcon(ToolBoxIcon.PASTE)); // "Save" the sourceCA and the JTextField in the button pasteButton.putClientProperty(TEXT_FIELD_PROPERTY, jtf); pasteButton.setBorderPainted(false); pasteButton.setContentAreaFilled(false); pasteButton.setMargin(new Insets(0, 0, 0, 0)); // Add the listener for the click on the button pasteButton.addActionListener(EventHandler.create(ActionListener.class, this, "onPaste", "")); buttonPanel.add(pasteButton); component.add(buttonPanel, "dock east"); } return component; }
/** * Pattern widget * * @return Pattern widget */ public JTextField getPatternWidget() { if (patternFld == null) { patternFld = new JTextField(pattern, 20); patternFld.setToolTipText( "<html>A string pattern to match or a comma separated numeric range:<br><i>e.g., -5.0,0</i></html>"); } return patternFld; }
public static Settings init() throws Exception { File f = new File("galaxyviewer.ini"); if (f.getAbsoluteFile().getParentFile().getName().equals("bin")) f = new File("..", "galaxyviewer.ini"); Settings settings; if (f.exists()) { settings = new Settings(); BufferedReader in = new BufferedReader(new FileReader(f)); while (true) { String s = in.readLine(); if (s == null) break; if (s.contains("=") == false) continue; String[] el = s.split("=", -1); if (el[0].equalsIgnoreCase("PlayerNr")) settings.playerNr = Integer.parseInt(el[1].trim()) - 1; if (el[0].equalsIgnoreCase("GameName")) settings.gameName = el[1].trim(); if (el[0].equalsIgnoreCase("GameDir")) settings.directory = el[1].trim(); } in.close(); } else settings = new Settings(); JTextField pNr = new JTextField("" + (settings.playerNr + 1)); JTextField gName = new JTextField(settings.gameName); JTextField dir = new JTextField("" + settings.directory); JPanel p = new JPanel(); p.setLayout(new GridLayout(3, 2)); p.add(new JLabel("Player nr")); p.add(pNr); p.add(new JLabel("Game name")); p.add(gName); p.add(new JLabel("Game directory")); p.add(dir); gName.setToolTipText("Do not include file extensions"); String[] el = {"Ok", "Cancel"}; int ok = JOptionPane.showOptionDialog( null, p, "Choose settings", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, el, el[0]); if (ok != 0) System.exit(0); settings.playerNr = Integer.parseInt(pNr.getText().trim()) - 1; settings.directory = dir.getText().trim(); settings.gameName = gName.getText().trim(); BufferedWriter out = new BufferedWriter(new FileWriter(f)); out.write("PlayerNr=" + (settings.playerNr + 1) + "\n"); out.write("GameName=" + settings.gameName + "\n"); out.write("GameDir=" + settings.directory + "\n"); out.flush(); out.close(); return settings; }
public AccesoSistema() { super("Ingreso Al Sistema"); setSize(400, 200); // el tamaño de la venta setLocationRelativeTo(null); // es para que la pantalla aparezaca en el centro setLayout(null); setVisible(true); // para mostrar la ventana // esta parte de arriba es el constructor : es el que le premite crear componentes lblimagen.setIcon(getClass().getResource("/Imagenes/Escudo.png")); lblimagen.setBounds(270, 10, 120, 140); this.add(lblimagen); lblusuario = new JLabel("Usuario: "); lblclave = new JLabel("Contraseña: "); txtusuario = new JTextField(""); txtclave = new JPasswordField(""); btningresar = new JButton("Ingresar"); txtusuario.addActionListener(this); txtclave.addActionListener(this); btningresar.addActionListener(this); // Ponemos A Escuchar El Boton btnsalir = new JButton("Salir"); btnsalir.addActionListener(this); lblusuario.setBounds(20, 20, 80, 25); lblclave.setBounds(20, 60, 80, 25); txtusuario.setBounds(130, 20, 120, 25); txtclave.setBounds(130, 60, 120, 25); btningresar.setBounds(20, 100, 120, 25); btnsalir.setBounds(150, 100, 120, 25); lblusuario.setForeground(new Color(0, 0, 0)); // lblusuario.setBorder(BorderFactory.createLineBorder(Color.yellow, WIDTH));//sirve para // mostrar el tamaño del lbl txtusuario.setBackground(Color.WHITE); // este es para darle color a la caja de texto txtusuario.setToolTipText("Ingrese Su Usuario"); // sirve para mostrar mensajes emergentes this.add(lblusuario); this.add(lblclave); this.add(txtusuario); this.add(txtclave); this.add(btningresar); this.add(btnsalir); this.repaint(); }
private JPanel buildSnipeSettings() { JPanel tp = new JPanel(); JLabel jl = new JLabel("How close to snipe (in seconds):"); tp.setBorder(BorderFactory.createTitledBorder("Snipe Timing")); tp.setLayout(new BorderLayout()); snipeTime = new JTextField(); snipeTime.addMouseListener(JPasteListener.getInstance()); snipeTime.setToolTipText("Number of seconds prior to auction end to fire a snipe."); snipeTime.setEditable(true); snipeTime .getAccessibleContext() .setAccessibleName("Default number of seconds prior to auction end to fire a snipe."); tp.add(jl, BorderLayout.NORTH); tp.add(snipeTime, BorderLayout.SOUTH); return (tp); }
public Animation() { String[] keys = {"no Animator found"}; if (tryDir(".")) // || tryDir("BLM305") || tryDir("CSE470")) keys = map.keySet().toArray(keys); System.out.println(map.size() + " classes loaded"); menu = new JComboBox(keys); pan.setLayout(new BorderLayout(GAP, GAP - 4)); pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP)); pan.setBackground(COLOR); last = new JPanel(); last.setPreferredSize(DIM); pan.add(last, "Center"); ref.setFont(NORM); ref.setEditable(false); ref.setColumns(35); ref.setDragEnabled(true); pan.add(ref, "North"); pan.add(bottomPanel(), "South"); pan.setToolTipText("A collective project for BLM320"); menu.setToolTipText("Animator classes"); who.setToolTipText("author()"); ref.setToolTipText("description()"); Closer ear = new Closer(); menu.addActionListener(ear); stop.addActionListener(ear); frm.addWindowListener(ear); if (map.size() > 0) setItem(0); frm.setContentPane(pan); frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frm.setLocation(scaled(120), scaled(90)); frm.pack(); // setSize() is called here frm.setVisible(true); start(); }
protected void init(Object value, Class<?> expectedClass) { boolean fieldEditable = Utils.isEditableType(expectedClass.getName()); clearObject(); if (value != null) { textField.setText(value.toString()); } else { // null String value for the moment textField.setText(""); } textField.setToolTipText(null); if (fieldEditable) { if (!textField.isEditable()) { textField.setEditable(true); } } else { if (textField.isEditable()) { textField.setEditable(false); } } }
public GUI() { String[] keys = {"no Quotation found"}; if (tryDir(".") || tryDir("BLM305") || tryDir("CSE470")) keys = Q.keySet().toArray(keys); menu = new JComboBox<String>(keys); if (Q.size() > 0) setMessage(0); JPanel pan = new JPanel(); pan.setLayout(new BorderLayout(GAP, GAP - 4)); pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP)); pan.setBackground(COLOR); pan.add(topPanel(), "North"); txt.setFont(LARGE); txt.setEditable(false); txt.setRows(5); txt.setColumns(30); txt.setWrapStyleWord(true); txt.setLineWrap(true); txt.setDragEnabled(true); pan.add(new JScrollPane(txt), "Center"); ref.setFont(SMALL); ref.setEditable(false); ref.setColumns(35); ref.setDragEnabled(true); pan.add(ref, "South"); pan.setToolTipText("A project realized collectively by the class"); menu.setToolTipText("Quotation classes"); who.setToolTipText("author()+year()"); txt.setToolTipText("text()"); ref.setToolTipText("reference()"); frm.setContentPane(pan); frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frm.setLocation(scaled(120), scaled(90)); frm.pack(); frm.setVisible(true); }
/** * Add to the properties list * * @param comps List of label/widgets * @param compMap Optional mapping to hold components for later access */ protected void getPropertiesComponents(List comps, Hashtable compMap) { super.getPropertiesComponents(comps, compMap); startTextFld = new JTextField(startText, 5); endTextFld = new JTextField(endText, 5); comps.add(GuiUtils.rLabel("Start Label:")); comps.add(GuiUtils.left(startTextFld)); comps.add(GuiUtils.rLabel("End Label:")); comps.add(GuiUtils.left(endTextFld)); maxDistanceFld = null; tvm = null; if (viewDescriptor != null) { VMManager vmManager = control.getControlContext().getIdv().getVMManager(); List vms = vmManager.getViewManagers(TransectViewManager.class); tvm = (TransectViewManager) VMManager.findViewManagerInList(viewDescriptor, vms); if ((tvm != null) && (maxDataDistance != null)) { maxDistanceFld = new JTextField(maxDataDistance.getValue() + " [" + maxDataDistance.getUnit() + "]", 15); maxDistanceFld.setToolTipText("Maximum distance shown. e.g.: value[unit]"); comps.add(GuiUtils.rLabel("Max distance:")); comps.add(GuiUtils.left(maxDistanceFld)); } } }
/** * Adds a row to a panel. * * @param panel the panel with a grid bag layout to add the row to * @param textField the text input field to add to the row. May be a <code>CheckedTextField</code> * . * @param labelText the label text preceding the text field * @param toolTip the tool tip text */ private void addRow( final JPanel panel, final JTextField textField, final String labelText, final String toolTip) { GridBagLayout gridbag = (GridBagLayout) panel.getLayout(); GridBagConstraints constraints = new GridBagConstraints(); // Ensure there is always a gap between components. constraints.insets = new Insets(2, 2, 2, 2); // Build the name row (label and text field). JLabel label = new JLabel(labelText); constraints.anchor = GridBagConstraints.EAST; constraints.gridwidth = 1; gridbag.setConstraints(label, constraints); panel.add(label); textField.setToolTipText(toolTip); textField.setName(labelText); constraints.anchor = GridBagConstraints.WEST; constraints.gridwidth = GridBagConstraints.REMAINDER; // end row gridbag.setConstraints(textField, constraints); panel.add(textField); }
/** Initializes all GUI components */ private void initComponents() { mainPanel = new JPanel(); editPanel = new JPanel(); editPanelLeft = new JPanel(); editPanelCenter = new JPanel(); editPanelRight = new JPanel(); tablePanel = new JPanel(); companyIdTextField = new JTextField(); companyIdTextField.setEditable(false); companyNameTextField = new JTextField(); urlTextField = new JTextField(); insuranceTypesTextField = new JTextField(); telephoneTextField = new JTextField(); percentageTextField = new JTextField(); percentageTextField.setToolTipText("<html>Only <b>numerical</b> values allowed</html>"); searchTextField = new JTextField(); searchTextField.setToolTipText( "<html>Use either <b>AND</b> or <b>OR</b> for combined search queries<br>You can also use <b>spaces</b> instead of <b>OR</b></html>"); generalDescriptionTextField = new JTextField(); companyIdLabel = new InsuranceCompanyLabel("ID"); companyNameLabel = new InsuranceCompanyLabel("Company"); urlLabel = new InsuranceCompanyLabel("Website"); insuranceTypesLabel = new InsuranceCompanyLabel("Insurance Types"); telephoneLabel = new InsuranceCompanyLabel("Telephone"); percentageLabel = new InsuranceCompanyLabel("Broker Percentage"); searchLabel = new InsuranceCompanyLabel("Search Insurance Types"); generalDescriptionLabel = new InsuranceCompanyLabel("General Description"); sortLabel = new InsuranceCompanyLabel("Sorting"); addInsuranceCompanyButton = new InsuranceCompanyButton("New Insurance Company", 190, 45); addInsuranceCompanyButton.setToolTipText( "<html>Create a new <b>empty</b> Insurance Company</html>"); saveInsuranceCompanyButton = new InsuranceCompanyButton("Save Insurance Company", 190, 45); saveInsuranceCompanyButton.setToolTipText( "<html>Save the <b>selected</b> Insurance Company<br>Hint: Press <b>Enter</b> to quickly save an entry</html>"); saveInsuranceCompanyButton.setDefaultCapable(true); getRootPane() .setDefaultButton( saveInsuranceCompanyButton); // Set the save button as default button, so quicker // editing by pressing Enter is possible deleteInsuranceCompanyButton = new InsuranceCompanyButton("Delete Insurance Company", 190, 45); deleteInsuranceCompanyButton.setToolTipText( "<html>Delete the <b>selected</b> Insurance Company</html>"); clearSearchButton = new InsuranceCompanyButton("x", 40, 35); clearSearchButton.setToolTipText("<html>Click to <b>clear</b> the search field</html>"); String[] sortStrategies = {"ID", "Company Name", "Percentage"}; sortComboBox = new JComboBox(sortStrategies); tableData = new InsuranceCompanyTableModel(model.getInsuranceCompanies()); insuranceCompaniesTable = new JTable(); insuranceCompanyScrollPane = new JScrollPane(insuranceCompaniesTable); // Set layout and add components to panels setLayout(new BorderLayout()); add(mainPanel, BorderLayout.CENTER); mainPanel.setLayout(new BorderLayout()); mainPanel.add(editPanel, BorderLayout.NORTH); editPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); editPanel.setLayout(new BorderLayout()); editPanel.add(editPanelLeft, BorderLayout.CENTER); editPanelLeft.setBorder(new EmptyBorder(0, 0, 5, 15)); editPanelLeft.setLayout(new GridLayout(4, 4, 5, 0)); editPanelLeft.add(companyIdLabel); editPanelLeft.add(companyNameLabel); editPanelLeft.add(urlLabel); editPanelLeft.add(telephoneLabel); editPanelLeft.add(companyIdTextField); editPanelLeft.add(companyNameTextField); editPanelLeft.add(urlTextField); editPanelLeft.add(telephoneTextField); editPanelLeft.add(percentageLabel); editPanelLeft.add(searchLabel); editPanelLeft.add(new JLabel()); editPanelLeft.add(sortLabel); editPanelLeft.add(percentageTextField); editPanelLeft.add(searchTextField); Container searchBox = Box.createVerticalBox(); searchBox.add(clearSearchButton); editPanelLeft.add(searchBox); editPanelLeft.add(sortComboBox); editPanel.add(editPanelRight, BorderLayout.EAST); Container box = Box.createVerticalBox(); box.add(saveInsuranceCompanyButton); box.add(Box.createVerticalStrut(5)); box.add(addInsuranceCompanyButton); box.add(Box.createVerticalStrut(5)); box.add(deleteInsuranceCompanyButton); editPanelRight.add(box); editPanel.add(editPanelCenter, BorderLayout.SOUTH); editPanelCenter.setLayout(new GridLayout(4, 1)); editPanelCenter.add(insuranceTypesLabel); editPanelCenter.add(insuranceTypesTextField); editPanelCenter.add(generalDescriptionLabel); editPanelCenter.add(generalDescriptionTextField); mainPanel.add(tablePanel, BorderLayout.CENTER); tablePanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEmptyBorder(10, 10, 10, 10), "Insurance Companies Overview")); tablePanel.setLayout(new BorderLayout()); tablePanel.add(insuranceCompanyScrollPane, BorderLayout.CENTER); setMinimumSize(new Dimension(800, 600)); setPreferredSize(new Dimension(900, 600)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); }
public void lock(String lockReason) { textField.setToolTipText(lockReason); textField.setEditable(false); }
public void unLock() { textField.setToolTipText(""); textField.setEditable(true); }
public BeastDialog(final JFrame frame, final String titleString, final Icon icon) { this.frame = frame; optionPanel = new OptionsPanel(12, 12); // this.frame = frame; JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(false); final OptionsPanel optionPanel3 = new OptionsPanel(0, 3); final JLabel titleIcon = new JLabel(); titleIcon.setIcon(icon); final JLabel titleText = new JLabel(titleString); optionPanel3.addComponent(titleText); // final JButton aboutButton = new JButton("About BEAST..."); // //aboutButton.setAction(); // optionPanel3.addComponent(aboutButton); optionPanel.addComponents(titleIcon, optionPanel3); final JButton inputFileButton = new JButton("Choose File..."); final JTextField inputFileNameText = new JTextField("not selected", 16); inputFileButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { FileDialog dialog = new FileDialog(frame, "Select target file...", FileDialog.LOAD); dialog.setVisible(true); if (dialog.getFile() == null) { // the dialog was cancelled... return; } inputFile = new File(dialog.getDirectory(), dialog.getFile()); inputFileNameText.setText(inputFile.getName()); } }); inputFileNameText.setEditable(false); JPanel panel1 = new JPanel(new BorderLayout(0, 0)); panel1.add(inputFileNameText, BorderLayout.CENTER); panel1.add(inputFileButton, BorderLayout.EAST); inputFileNameText.setToolTipText( "<html>Drag a BEAST XML file here or use the button to<br>" + "select one from a file dialog box.</html>"); inputFileButton.setToolTipText( "<html>Drag a BEAST XML file here or use the button to<br>" + "select one from a file dialog box.</html>"); optionPanel.addComponentWithLabel("BEAST XML File: ", panel1); Color focusColor = UIManager.getColor("Focus.color"); Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor); new FileDrop( null, inputFileNameText, focusBorder, new FileDrop.Listener() { public void filesDropped(java.io.File[] files) { inputFile = files[0]; inputFileNameText.setText(inputFile.getName()); } // end filesDropped }); // end FileDrop.Listener overwriteCheckBox.setToolTipText( "<html>Specify whether BEAST will overwrite existing log files<br>" + "with the same name.</html>"); optionPanel.addComponent(overwriteCheckBox); optionPanel.addSeparator(); seedText.setColumns(12); seedText.setToolTipText( "<html>Specify a particular random number seed to replicate<br>" + "precisely the sequence of steps in the MCMC chain. By<br>" + "default this uses system information to provide a new<br>" + "seed each run.</html>"); optionPanel.addComponentWithLabel("Random number seed: ", seedText); threadsCombo.setToolTipText( "<html>Specify how large a thread pool to use.<br>" + "In most circumstances this should be set to 'automatic'<br>" + "but in some circumstances it may be desirable to restict<br>" + "the number of cores being used. 0 will turn off threading</html>"); optionPanel.addComponentWithLabel("Thread pool size: ", threadsCombo); optionPanel.addSeparator(); optionPanel.addSpanningComponent(beagleCheckBox); beagleCheckBox.setSelected(true); final OptionsPanel optionPanel1 = new OptionsPanel(0, 6); // optionPanel1.setBorder(BorderFactory.createEmptyBorder()); optionPanel1.setBorder(new TitledBorder("")); OptionsPanel optionPanel2 = new OptionsPanel(0, 3); optionPanel2.setBorder(BorderFactory.createEmptyBorder()); final JLabel label1 = optionPanel2.addComponentWithLabel("Prefer use of: ", beagleResourceCombo); optionPanel2.addComponent(beagleSSECheckBox); beagleSSECheckBox.setSelected(true); final JLabel label2 = optionPanel2.addComponentWithLabel("Prefer precision: ", beaglePrecisionCombo); final JLabel label3 = optionPanel2.addComponentWithLabel("Rescaling scheme: ", beagleScalingCombo); optionPanel2.addComponent(beagleInfoCheckBox); optionPanel2.setBorder(BorderFactory.createEmptyBorder()); optionPanel1.addComponent(optionPanel2); final JEditorPane beagleInfo = new JEditorPane( "text/html", "<html><div style=\"font-family:'helvetica neue light',helvetica,sans-serif;font-size:12;\"><p>BEAGLE is a high-performance phylogenetic library that can make use of<br>" + "additional computational resources such as graphics boards. It must be<br>" + "downloaded and installed independently of BEAST:</p>" + "<pre><a href=\"http://beagle-lib.googlecode.com/\">http://beagle-lib.googlecode.com/</a></pre></div>"); beagleInfo.setOpaque(false); beagleInfo.setEditable(false); beagleInfo.addHyperlinkListener(new SimpleLinkListener()); optionPanel1.addComponent(beagleInfo); optionPanel1.setBorder(BorderFactory.createEmptyBorder()); optionPanel.addSpanningComponent(optionPanel1); beagleInfoCheckBox.setEnabled(false); beagleCheckBox.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { beagleInfo.setEnabled(beagleCheckBox.isSelected()); beagleInfoCheckBox.setEnabled(beagleCheckBox.isSelected()); label1.setEnabled(beagleCheckBox.isSelected()); beagleResourceCombo.setEnabled(beagleCheckBox.isSelected()); beagleSSECheckBox.setEnabled(beagleCheckBox.isSelected()); label2.setEnabled(beagleCheckBox.isSelected()); beaglePrecisionCombo.setEnabled(beagleCheckBox.isSelected()); label3.setEnabled(beagleCheckBox.isSelected()); beagleScalingCombo.setEnabled(beagleCheckBox.isSelected()); } }); beagleCheckBox.setSelected(false); beagleResourceCombo.setSelectedItem("CPU"); }
/** the JbInit method */ public void jbInit() throws Exception { // Layout definition for this panel dataPanel.setLayout(panelLayout); dataPanel.setMinimumSize(new Dimension(100, 100)); this.setLayout(borderLayout); this.setSize(new Dimension(862, 514)); this.setPreferredSize(new Dimension(479, 306)); this.setMinimumSize(new Dimension(479, 306)); this.setMaximumSize(new Dimension(479, 306)); mIdtraslo.setDocument((Document) panelBinding.bindUIControl("Idtraslo", mIdtraslo)); mIdtraslo.setEditable(false); mDescrip.setFocusable(false); mDescrip.setEditable(false); mEstadotraslotxt.setFocusable(false); mEstadopasillotxt.setFocusable(false); mEstadoprocesotraslotxt.setFocusable(false); mDescripvisualEntrada.setFocusable(false); mDescripvisualSalida.setFocusable(false); mPasilloactual.setFocusable(false); mPasillodestino.setFocusable(true); mPosplc.setFocusable(false); jCheckBoxTrasbordoEntrada.setText("Trasbord Entradas"); jCheckBoxTrasbordoEntrada.setToolTipText( "Realitzar trasbord per ubicar containers en entrada de passadis"); dataPanel.add( labelIdtraslo, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mIdtraslo, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelIdtraslo.setLabelFor(mIdtraslo); mIdtraslo.setColumns(5); labelIdtraslo.setText(panelBinding.findCtrlValueBinding("Idtraslo").getLabel()); mIdtraslo.setToolTipText(panelBinding.findCtrlValueBinding("Idtraslo").getTooltip()); mDescrip.setDocument((Document) panelBinding.bindUIControl("Descrip", mDescrip)); dataPanel.add( labelDescrip, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mDescrip, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelDescrip.setLabelFor(mDescrip); mDescrip.setColumns(15); labelDescrip.setText(panelBinding.findCtrlValueBinding("Descrip").getLabel()); mDescrip.setToolTipText(panelBinding.findCtrlValueBinding("Descrip").getTooltip()); mEstadotraslotxt.setDocument( (Document) panelBinding.bindUIControl("Estadotraslotxt", mEstadotraslotxt)); dataPanel.add( labelEstadotraslotxt, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mEstadotraslotxt, new GridBagConstraints( 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelEstadotraslotxt.setLabelFor(mEstadotraslotxt); mEstadotraslotxt.setColumns(20); labelEstadotraslotxt.setText(panelBinding.findCtrlValueBinding("Estadotraslotxt").getLabel()); mEstadotraslotxt.setToolTipText( panelBinding.findCtrlValueBinding("Estadotraslotxt").getTooltip()); mEstadopasillotxt.setDocument( (Document) panelBinding.bindUIControl("Estadopasillotxt", mEstadopasillotxt)); dataPanel.add( labelEstadopasillotxt, new GridBagConstraints( 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mEstadopasillotxt, new GridBagConstraints( 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelEstadopasillotxt.setLabelFor(mEstadopasillotxt); mEstadopasillotxt.setColumns(20); labelEstadopasillotxt.setText(panelBinding.findCtrlValueBinding("Estadopasillotxt").getLabel()); mEstadopasillotxt.setToolTipText( panelBinding.findCtrlValueBinding("Estadopasillotxt").getTooltip()); mEstadoprocesotraslotxt.setDocument( (Document) panelBinding.bindUIControl("Estadoprocesotraslotxt", mEstadoprocesotraslotxt)); dataPanel.add( labelEstadoprocesotraslotxt, new GridBagConstraints( 0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mEstadoprocesotraslotxt, new GridBagConstraints( 1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelEstadoprocesotraslotxt.setLabelFor(mEstadoprocesotraslotxt); mEstadoprocesotraslotxt.setColumns(20); labelEstadoprocesotraslotxt.setText( panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getLabel()); mEstadoprocesotraslotxt.setToolTipText( panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getTooltip()); mDescripvisualEntrada.setDocument( (Document) panelBinding.bindUIControl("DescripvisualEntrada", mDescripvisualEntrada)); dataPanel.add( labelDescripvisualEntrada, new GridBagConstraints( 0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mDescripvisualEntrada, new GridBagConstraints( 1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelDescripvisualEntrada.setLabelFor(mDescripvisualEntrada); mDescripvisualEntrada.setColumns(20); labelDescripvisualEntrada.setText( panelBinding.findCtrlValueBinding("DescripvisualEntrada").getLabel()); mDescripvisualEntrada.setToolTipText( panelBinding.findCtrlValueBinding("DescripvisualEntrada").getTooltip()); mDescripvisualSalida.setDocument( (Document) panelBinding.bindUIControl("DescripvisualSalida", mDescripvisualSalida)); dataPanel.add( labelDescripvisualSalida, new GridBagConstraints( 0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mDescripvisualSalida, new GridBagConstraints( 1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelDescripvisualSalida.setLabelFor(mDescripvisualSalida); mDescripvisualSalida.setColumns(20); labelDescripvisualSalida.setText( panelBinding.findCtrlValueBinding("DescripvisualSalida").getLabel()); mDescripvisualSalida.setToolTipText( panelBinding.findCtrlValueBinding("DescripvisualSalida").getTooltip()); mPasilloactual.setDocument( (Document) panelBinding.bindUIControl("Pasilloactual", mPasilloactual)); dataPanel.add( labelPasilloactual, new GridBagConstraints( 0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mPasilloactual, new GridBagConstraints( 1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelPasilloactual.setLabelFor(mPasilloactual); mPasilloactual.setColumns(3); labelPasilloactual.setText(panelBinding.findCtrlValueBinding("Pasilloactual").getLabel()); mPasilloactual.setToolTipText(panelBinding.findCtrlValueBinding("Pasilloactual").getTooltip()); mPasillodestino.setDocument( (Document) panelBinding.bindUIControl("Pasillodestino", mPasillodestino)); dataPanel.add( labelPasillodestino, new GridBagConstraints( 0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mPasillodestino, new GridBagConstraints( 1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); labelPasillodestino.setLabelFor(mPasillodestino); mPasillodestino.setColumns(3); labelPasillodestino.setText(panelBinding.findCtrlValueBinding("Pasillodestino").getLabel()); mPasillodestino.setToolTipText( panelBinding.findCtrlValueBinding("Pasillodestino").getTooltip()); mPosplc.setDocument((Document) panelBinding.bindUIControl("Posplc", mPosplc)); dataPanel.add( labelPosplc, new GridBagConstraints( 0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); dataPanel.add( mPosplc, new GridBagConstraints( 1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 1, 1)); // dataPanel.add(buttonArrancar, new GridBagConstraints(0, 10, 3, 2, 0.0, 0.0, // GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 22, 63), -98, -13)); dataPanel.add( buttonArrancar, new GridBagConstraints( 0, 10, 3, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0)); // dataPanel.add(jCheckBoxTrasbordoEntrada, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, // GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); labelPosplc.setLabelFor(mPosplc); mPosplc.setColumns(5); labelPosplc.setText(panelBinding.findCtrlValueBinding("Posplc").getLabel()); // Layout the datapanel and the navigation bar mPosplc.setToolTipText(panelBinding.findCtrlValueBinding("Posplc").getTooltip()); add(dataPanel, BorderLayout.CENTER); navBar.setModel( JUNavigationBar.createViewBinding( panelBinding, navBar, "SgavtrasloEntSalView1", null, "SgavtrasloEntSal1Iter")); statusBar.setModel(JUStatusBar.createPanelBinding(panelBinding, statusBar)); add(navBar, BorderLayout.NORTH); add(statusBar, BorderLayout.SOUTH); // Quitar botones de add / remove navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_DELETE)); navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_INSERT)); jCheckBoxTrasbordoEntrada.setModel( (ButtonModel) panelBinding.bindUIControl("Trasbordoentrada", jCheckBoxTrasbordoEntrada)); if (getIdTraslo() == 0) jCheckBoxTrasbordoEntrada.setEnabled(false); }
private void initComponents() { dialogPane = new JPanel(); contentPanel = new JPanel(); scrollPane1 = new JScrollPane(); table = new JTable(); filterPanel = new JPanel(); filterLabel = new JLabel(); filterTextField = new JTextField(); rowCountLabel = new JLabel(); buttonBar = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); getRootPane().setDefaultButton(okButton); final String filterToolTip = "Enter multiple filter strings separated by commas. e.g. GM12878, ChipSeq"; filterLabel.setToolTipText(filterToolTip); filterTextField.setToolTipText(filterToolTip); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== contentPanel.setLayout(new BorderLayout(0, 10)); // ======== scrollPane1 ======== scrollPane1.setViewportView(table); contentPanel.add(scrollPane1, BorderLayout.CENTER); // ======== panel1 ======== filterPanel.setLayout(new JideBoxLayout(filterPanel, JideBoxLayout.X_AXIS, 5)); // ---- label1 ---- filterLabel.setText("Filter:"); filterPanel.add(filterLabel, JideBoxLayout.FIX); // ---- filterTextField ---- filterPanel.add(filterTextField, JideBoxLayout.VARY); rowCountLabel.setHorizontalAlignment(JLabel.RIGHT); JPanel sillyPanel = new JPanel(); sillyPanel.setLayout(new JideBoxLayout(sillyPanel, JideBoxLayout.X_AXIS, 0)); sillyPanel.setPreferredSize(new Dimension(100, 28)); sillyPanel.add(rowCountLabel, JideBoxLayout.VARY); filterPanel.add(sillyPanel, JideBoxLayout.FIX); contentPanel.add(filterPanel, BorderLayout.NORTH); dialogPane.add(contentPanel, BorderLayout.CENTER); // ======== buttonBar ======== buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout()); ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80}; ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0}; // ---- okButton ---- okButton.setText("Load"); okButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadButtonActionPerformed(e); } }); buttonBar.add( okButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ---- cancelButton ---- cancelButton.setText("Cancel"); cancelButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(e); } }); buttonBar.add( cancelButton, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); dialogPane.add(buttonBar, BorderLayout.SOUTH); contentPane.add(dialogPane, BorderLayout.CENTER); setSize(700, 620); setLocationRelativeTo(getOwner()); }
public final void createBathymetryUI(boolean bandCreated) { final int rightInset = 5; final MaskEnabledAllBandsCheckbox maskEnabledAllBandsCheckbox = new MaskEnabledAllBandsCheckbox(bathymetryData); final MaskTransparencySpinner maskTransparencySpinner = new MaskTransparencySpinner(bathymetryData); final MaskColorComboBox maskColorComboBox = new MaskColorComboBox(bathymetryData); final MaskMaxDepthTextfield maskMaxDepthTextfield = new MaskMaxDepthTextfield(bathymetryData); final MaskMinDepthTextfield maskMinDepthTextfield = new MaskMinDepthTextfield(bathymetryData); final boolean[] fileSelectorEnabled = {true}; if (bandCreated) { fileSelectorEnabled[0] = false; } else { fileSelectorEnabled[0] = true; } final ResolutionComboBox resolutionComboBox = new ResolutionComboBox(bathymetryData); JPanel resolutionSamplingPanel = new JPanel(new GridBagLayout()); resolutionSamplingPanel.setBorder(BorderFactory.createTitledBorder("")); if (fileSelectorEnabled[0]) { resolutionSamplingPanel.add( resolutionComboBox.getjLabel(), new ExGridBagConstraints( 0, 0, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); JComboBox jComboBox = resolutionComboBox.getjComboBox(); jComboBox.setEnabled(fileSelectorEnabled[0]); bathymetryData.addPropertyChangeListener( BathymetryData.PROMPT_REQUEST_TO_INSTALL_FILE_EVENT, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SourceFileInfo sourceFileInfo = (SourceFileInfo) resolutionComboBox.getjComboBox().getSelectedItem(); InstallResolutionFileDialog dialog = new InstallResolutionFileDialog( bathymetryData, sourceFileInfo, InstallResolutionFileDialog.Step.INSTALLATION); dialog.setVisible(true); dialog.setEnabled(true); } }); resolutionSamplingPanel.add( jComboBox, new ExGridBagConstraints(1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); } else { resolutionSamplingPanel.add( new JLabel("Note: Cannot recreate a different band, only a different mask"), new ExGridBagConstraints(1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); } JPanel maskJPanel = new JPanel(new GridBagLayout()); maskJPanel.setBorder(BorderFactory.createTitledBorder("")); JTextField maskNameTextfield = new JTextField(bathymetryData.getMaskName()); maskNameTextfield.setEditable(false); maskNameTextfield.setToolTipText("Name of the mask (this field is not editable)"); maskJPanel.add( new JLabel("Mask Name"), new ExGridBagConstraints( 0, 0, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); maskJPanel.add( maskNameTextfield, new ExGridBagConstraints(1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); maskJPanel.add( maskColorComboBox.getjLabel(), new ExGridBagConstraints( 0, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); maskJPanel.add( maskColorComboBox.getColorExComboBox(), new ExGridBagConstraints(1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); maskJPanel.add( maskTransparencySpinner.getjLabel(), new ExGridBagConstraints( 0, 2, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); maskJPanel.add( maskTransparencySpinner.getjSpinner(), new ExGridBagConstraints(1, 2, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); maskJPanel.add( maskMaxDepthTextfield.getjLabel(), new ExGridBagConstraints( 0, 3, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); maskJPanel.add( maskMaxDepthTextfield.getjTextField(), new ExGridBagConstraints(1, 3, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); maskJPanel.add( maskMinDepthTextfield.getjLabel(), new ExGridBagConstraints( 0, 4, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); maskJPanel.add( maskMinDepthTextfield.getjTextField(), new ExGridBagConstraints(1, 4, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); maskJPanel.add( maskEnabledAllBandsCheckbox.getjLabel(), new ExGridBagConstraints( 0, 5, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, rightInset))); maskJPanel.add( maskEnabledAllBandsCheckbox.getjCheckBox(), new ExGridBagConstraints(1, 5, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.add( resolutionSamplingPanel, new ExGridBagConstraints( 0, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 3)); mainPanel.add( maskJPanel, new ExGridBagConstraints( 0, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 3)); String label; if (bandCreated) { label = "Recreate Bathymetry Mask"; } else { label = "Create Bathymetry Band and Mask"; } JButton createMasks = new JButton(label); createMasks.setPreferredSize(createMasks.getPreferredSize()); createMasks.setMinimumSize(createMasks.getPreferredSize()); createMasks.setMaximumSize(createMasks.getPreferredSize()); createMasks.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { bathymetryData.setCreateMasks(true); dispose(); } }); JButton cancelButton = new JButton("Cancel"); cancelButton.setPreferredSize(cancelButton.getPreferredSize()); cancelButton.setMinimumSize(cancelButton.getPreferredSize()); cancelButton.setMaximumSize(cancelButton.getPreferredSize()); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { dispose(); } }); JLabel filler = new JLabel(" "); JPanel buttonsJPanel = new JPanel(new GridBagLayout()); buttonsJPanel.add( cancelButton, new ExGridBagConstraints(0, 0, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE)); buttonsJPanel.add( filler, new ExGridBagConstraints( 1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL)); buttonsJPanel.add( createMasks, new ExGridBagConstraints(2, 0, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE)); buttonsJPanel.add( helpButton, new ExGridBagConstraints(3, 0, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE)); createMasks.setAlignmentX(0.5f); mainPanel.add( buttonsJPanel, new ExGridBagConstraints(0, 4, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, 5)); add(mainPanel); setModalityType(ModalityType.APPLICATION_MODAL); setTitle("Bathymetry"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLocationRelativeTo(null); pack(); setPreferredSize(getPreferredSize()); setMinimumSize(getPreferredSize()); setMaximumSize(getPreferredSize()); setSize(getPreferredSize()); }
private void jbInit() throws Exception { border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); border2 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); border3 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder1 = new TitledBorder(border3, "Subject"); border4 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder2 = new TitledBorder(border4, "Message"); border5 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder3 = new TitledBorder(border5, "Subject"); border6 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder4 = new TitledBorder(border6, "Message"); border7 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder5 = new TitledBorder(border7, "Messages"); border8 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder6 = new TitledBorder(border8, "Online Users"); border9 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder7 = new TitledBorder(border9, "Send Message"); this.getContentPane().setLayout(borderLayout1); jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane1.setBorder(border1); jSplitPane1.setLastDividerLocation(250); jSplitPane1.setResizeWeight(1.0); jLabelServer.setRequestFocusEnabled(true); jLabelServer.setText("Server"); jLabelUserId.setText("User Id"); jTextFieldServer.setPreferredSize(new Dimension(75, 20)); jTextFieldServer.setText(""); jTextFieldUser.setPreferredSize(new Dimension(75, 20)); jTextFieldUser.setText(""); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setJMenuBar(jMenuBarMain); this.setTitle("Message Client"); jLabeltargetUser.setText("Target"); jTextFieldTargetUser.setPreferredSize(new Dimension(75, 20)); jTextFieldTargetUser.setText(""); jPanelSendMessages.setBorder(border2); jPanelSendMessages.setMaximumSize(new Dimension(32767, 32767)); jPanelSendMessages.setOpaque(false); jPanelSendMessages.setPreferredSize(new Dimension(96, 107)); jPanelSendMessages.setRequestFocusEnabled(true); jPanelSendMessages.setToolTipText(""); jPanelSendMessages.setLayout(verticalFlowLayout1); jTextFieldSendSubject.setBorder(titledBorder3); jTextFieldSendSubject.setText(""); jTextFieldSendSubject.addKeyListener(new Client_jTextFieldSendSubject_keyAdapter(this)); jSplitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT); jScrollPane1.setBorder(titledBorder5); jScrollPane2.setBorder(titledBorder6); jToggleButtonRegister.setText("Register"); jToggleButtonRegister.addActionListener(new Client_jToggleButtonRegister_actionAdapter(this)); jButtonMultiConnect.setText("Multi-Connect"); jButtonMultiConnect.addActionListener(new Client_jButtonMultiConnect_actionAdapter(this)); jListOnlineUsers.addMouseListener(new Client_jListOnlineUsers_mouseAdapter(this)); jToggleButtonConnect.setText("Connect"); jToggleButtonConnect.addActionListener(new Client_jToggleButtonConnect_actionAdapter(this)); jTextPaneDisplayMessages.setEditable(false); jTextPaneDisplayMessages.addMouseListener( new Client_jTextPaneDisplayMessages_mouseAdapter(this)); jTextFieldSendMessages.setBorder(titledBorder7); jTextFieldSendMessages.setToolTipText(""); jTextFieldSendMessages.addKeyListener(new Client_jTextFieldSendMessages_keyAdapter(this)); jButtonMessageStresser.setText("Msg Stresser"); jButtonMessageStresser.addActionListener( new Client_jToggleButtonMessageStresser_actionAdapter(this)); jMenuItemClearMessages.setText("Clear Messages"); jMenuItemClearMessages.addActionListener(new Client_jMenuItemClearMessages_actionAdapter(this)); jMenuServer.setText("Server"); jMenuItemServerConnect.setText("Connect"); jMenuItemServerConnect.addActionListener(new Client_jMenuItemServerConnect_actionAdapter(this)); jMenuItemServerDisconnect.setText("Disconnect"); jMenuItemServerDisconnect.addActionListener( new Client_jMenuItemServerDisconnect_actionAdapter(this)); jMenuOptions.setText("Options"); jMenuTest.setText("Test"); jMenuItemOptionsRegister.setText("Register"); jMenuItemOptionsRegister.addActionListener( new Client_jMenuItemOptionsRegister_actionAdapter(this)); jMenuItemOptionsDeregister.setText("Deregister"); jMenuItemOptionsDeregister.addActionListener( new Client_jMenuItemOptionsDeregister_actionAdapter(this)); jMenuItemOptionsEavesdrop.setText("Eavesdrop"); jMenuItemOptionsEavesdrop.addActionListener( new Client_jMenuItemOptionsEavesdrop_actionAdapter(this)); jMenuItemOptionsUneavesdrop.setText("Uneavesdrop"); jMenuItemOptionsUneavesdrop.addActionListener( new Client_jMenuItemOptionsUneavesdrop_actionAdapter(this)); jMenuItemTestMulticonnect.setText("Multiconnect"); jMenuItemTestMulticonnect.addActionListener( new Client_jMenuItemTestMulticonnect_actionAdapter(this)); jMenuItemTestMessageStresser.setText("Message Stresser"); jMenuItemTestMessageStresser.addActionListener( new Client_jMenuItemTestMessageStresser_actionAdapter(this)); jMenuItemTestMultidisconnect.setText("Multidisconnect"); jMenuItemTestMultidisconnect.addActionListener( new Client_jMenuItemTestMultidisconnect_actionAdapter(this)); jMenuItemOptionsGlobalEavesdrop.setText("Global Eavesdrop"); jMenuItemOptionsGlobalEavesdrop.addActionListener( new Client_jMenuItemOptionsGlobalEavesdrop_actionAdapter(this)); jMenuItemOptionsGlobalUneavesdrop.setEnabled(false); jMenuItemOptionsGlobalUneavesdrop.setText("Global Uneavesdrop"); jMenuItemOptionsGlobalUneavesdrop.addActionListener( new Client_jMenuItemOptionsGlobalUneavesdrop_actionAdapter(this)); jLabelPwd.setText("Pwd"); jPasswordFieldPwd.setMinimumSize(new Dimension(11, 20)); jPasswordFieldPwd.setPreferredSize(new Dimension(75, 20)); jPasswordFieldPwd.setText(""); jMenuItemScheduleCommand.setText("Schedule Command"); jMenuItemScheduleCommand.addActionListener( new Client_jMenuItemScheduleCommand_actionAdapter(this)); jMenuItemEditScheduledCommands.setText("Edit Scheduled Commands"); jMenuItemEditScheduledCommands.addActionListener( new Client_jMenuItemEditScheduledCommands_actionAdapter(this)); jPanelSendMessages.add(jTextFieldSendSubject, null); jPanelSendMessages.add(jTextFieldSendMessages, null); jSplitPane1.add(jSplitPane2, JSplitPane.TOP); jSplitPane2.add(jScrollPane1, JSplitPane.TOP); jScrollPane1.getViewport().add(jTextPaneDisplayMessages, null); jSplitPane2.add(jScrollPane2, JSplitPane.BOTTOM); jScrollPane2.getViewport().add(jListOnlineUsers, null); this.getContentPane().add(jSplitPane1, BorderLayout.CENTER); jSplitPane1.add(jPanelSendMessages, JSplitPane.BOTTOM); this.getContentPane().add(jPanel1, BorderLayout.NORTH); jPanel1.add(jLabelServer, null); jPanel1.add(jTextFieldServer, null); jPanel1.add(jLabelUserId, null); jPanel1.add(jTextFieldUser, null); jPanel1.add(jLabelPwd, null); jPanel1.add(jPasswordFieldPwd, null); jPanel1.add(jLabeltargetUser, null); jPanel1.add(jTextFieldTargetUser, null); jPanel1.add(jToggleButtonConnect, null); jPanel1.add(jToggleButtonRegister, null); jPanel1.add(jButtonMultiConnect, null); jPanel1.add(jButtonMessageStresser, null); jPopupMenuMessageArea.add(jMenuItemClearMessages); jMenuBarMain.add(jMenuServer); jMenuBarMain.add(jMenuOptions); jMenuBarMain.add(jMenuTest); jMenuServer.add(jMenuItemServerConnect); jMenuServer.add(jMenuItemServerDisconnect); jMenuOptions.add(jMenuItemOptionsRegister); jMenuOptions.add(jMenuItemOptionsDeregister); jMenuOptions.add(jMenuItemOptionsEavesdrop); jMenuOptions.add(jMenuItemOptionsUneavesdrop); jMenuOptions.add(jMenuItemOptionsGlobalEavesdrop); jMenuOptions.add(jMenuItemOptionsGlobalUneavesdrop); jMenuTest.add(jMenuItemTestMulticonnect); jMenuTest.add(jMenuItemTestMultidisconnect); jMenuTest.add(jMenuItemTestMessageStresser); jMenuTest.add(jMenuItemScheduleCommand); jMenuTest.add(jMenuItemEditScheduledCommands); jSplitPane1.setDividerLocation(200); jSplitPane2.setDividerLocation(600); jListOnlineUsers.setCellRenderer(new OnlineListCellRenderer()); jListOnlineUsers.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); jMenuItemTestMulticonnect.setEnabled(true); jMenuItemTestMultidisconnect.setEnabled(false); jMenuItemServerConnect.setEnabled(true); jMenuItemServerDisconnect.setEnabled(false); jMenuItemOptionsRegister.setEnabled(true); jMenuItemOptionsDeregister.setEnabled(false); }
private JTextField makeField(String s, ObjectListener listener, String tip) { JTextField fld = new JTextField(s, 3); if (listener != null) fld.addActionListener(listener); fld.setToolTipText(tip); return fld; }
/** * Constructs a new {@link FileLoadingPanel} object containing: * * <ul> * <li>loadButton- clicking opens Cytoscape's FileChooser to choose a data file * <li>label - displays the path of the chosen file * <li>textField - can be edited such that an abbreviation for the data set can be given * <li>removeButton - removes this object from the GUI * </ul> * * @param dataPanel - The {@link DataPanel} which created this {@link FileLoadingPanel}. */ public KPMFileLoadingPanel(KPMDataTab dataPanel) { this.dataPanel = dataPanel; fileChooserFilter = new FileChooserFilter("*.csv,*.txt,*.dat", DATA_EXTENSIONS); filterList = new ArrayList<FileChooserFilter>(1); filterList.add(fileChooserFilter); loadButton = new JButton("Load"); loadButton.setToolTipText(LOADBUTTONTIP); JPanel loadButtonPanel = new JPanel(); loadButtonPanel.add(loadButton); loadButtonPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); label = new JLabel(PATHLABELDEFAULT); label.setToolTipText(PATHLABELTIP); textField = new JTextField(ABBREVIATIONFIELDDEFAULT, 20); textField.setToolTipText(TEXTFIELDTIP); nodesCountLabel = new JLabel(""); nodesCountLabel.setToolTipText( "Number of entities in the dataset, for instance genes or proteins."); samplesCountLabel = new JLabel(""); removeButton = new JButton(); JPanel removeButtonPanel = new JPanel(); removeButtonPanel.add(removeButton); removeButtonPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); removeIcon = new ImageIcon(this.getClass().getResource("/minus.png"), "Remove"); removeButton.setIcon(removeIcon); removeButton.setToolTipText(REMOVEBUTTONTIP); id = NOOFPANELS++; addLoadButtonListener(); addRemoveButtonListener(); addTextFieldListener(); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 0; c.gridheight = 3; add(loadButtonPanel, c); c.gridx = 1; c.gridy = 0; c.weightx = .5; c.gridheight = 1; c.gridwidth = 3; add(label, c); c.gridwidth = 1; c.gridx = 1; c.gridy = 2; add(nodesCountLabel, c); c.gridx = 2; c.gridy = 2; add(samplesCountLabel, c); c.gridx = 1; c.gridy = 1; c.gridwidth = 3; add(textField, c); c.gridx = 4; c.gridy = 0; c.weightx = 0; c.gridheight = 3; c.gridwidth = 1; add(removeButtonPanel, c); // setMaximumSize(new Dimension(Integer.MAX_VALUE, // 3 * removeIcon.getIconHeight())); // Add a border. Border border = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); this.setBorder(border); }
@Override public void setToolTipText(String text) { super.setToolTipText(text); textLabel.setToolTipText(text); textField.setToolTipText(text); }
public ThumbMaker() { super("ThumbMaker"); // grab the preferences so that they can be used to fill out the layout ThumbMakerPreferences myPrefs = ThumbMakerPreferences.getInstance(); // content pane JPanel pane = new JPanel(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); setContentPane(pane); // top panel JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS)); pane.add(top); // left-hand panel JPanel left = new JPanel(); left.setLayout(new BoxLayout(left, BoxLayout.Y_AXIS)); top.add(left); // horizontal padding top.add(Box.createHorizontalStrut(5)); // label for file list JLabel listLabel = GUIUtil.makeLabel("Files to process:"); listLabel.setDisplayedMnemonic('f'); String listTip = "List of files from which to create thumbnails"; listLabel.setToolTipText(listTip); left.add(GUIUtil.pad(listLabel)); // list of files to convert list = new JList(); listLabel.setLabelFor(list); list.setToolTipText(listTip); list.setModel(new DefaultListModel()); list.setDragEnabled(true); changeFilesInList = new ThumbTransferHandler(); list.setTransferHandler(changeFilesInList); left.add(new JScrollPane(list)); // progress bar progress = new JProgressBar(0, 1); progress.setString("[Drag and drop files onto list to begin]"); progress.setStringPainted(true); progress.setToolTipText("Status of thumbnail processing operation"); left.add(progress); // panel for process and remove buttons JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // add files button addFiles = new JButton("Add Files"); addFiles.setMnemonic('d'); addFiles.setToolTipText("Add files to be processed."); addFiles.addActionListener(this); p.add(addFiles); p.add(Box.createHorizontalStrut(5)); // process button process = new JButton("Process"); process.setMnemonic('p'); process.setToolTipText("Begin creating thumbnails"); process.addActionListener(this); p.add(process); p.add(Box.createHorizontalStrut(5)); // remove button remove = new JButton("Remove"); remove.setMnemonic('v'); remove.setToolTipText("Remove selected files from the list"); remove.addActionListener(this); p.add(remove); left.add(GUIUtil.pad(p)); // right-hand panel JPanel right = new JPanel(); right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS)); top.add(right); // panel for resolution settings p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // resolution label JLabel resLabel = GUIUtil.makeLabel("Resolution: "); resLabel.setDisplayedMnemonic('s'); resLabel.setToolTipText("Resolution of the thumbnails"); p.add(resLabel); // x resolution text box xres = GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME), 2); resLabel.setLabelFor(xres); xres.setToolTipText("Thumbnail width"); p.add(xres); // "by" label JLabel byLabel = GUIUtil.makeLabel(" by "); byLabel.setDisplayedMnemonic('y'); p.add(byLabel); // y resolution text box yres = GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME), 2); byLabel.setLabelFor(yres); yres.setToolTipText("Thumbnail height"); p.add(yres); right.add(GUIUtil.pad(p)); right.add(Box.createVerticalStrut(8)); // aspect ratio checkbox aspect = new JCheckBox("Maintain aspect ratio", true); aspect.setMnemonic('m'); aspect.setToolTipText( "When checked, thumbnails are not stretched, " + "but rather padded with the background color."); aspect.addActionListener(this); right.add(GUIUtil.pad(aspect)); // make sure that the check box is initialized correctly aspect.setSelected( myPrefs .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME) .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING)); // panel for background color p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // load the color values from the preferences int redValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME); int greenValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME); int blueValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME); // background color label colorLabel = GUIUtil.makeLabel("Background color: "); String colorTip = "Thumbnail background color"; colorLabel.setToolTipText(colorTip); p.add(colorLabel); // background color colorBox = new JPanel(); colorBox.setToolTipText(colorTip); colorBox.setBorder(new LineBorder(Color.black, 1)); Dimension colorBoxSize = new Dimension(45, 15); colorBox.setMaximumSize(colorBoxSize); colorBox.setMinimumSize(colorBoxSize); colorBox.setPreferredSize(colorBoxSize); colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber)); p.add(colorBox); right.add(GUIUtil.pad(p)); right.add(Box.createVerticalStrut(2)); // red slider redLabel = GUIUtil.makeLabel("R"); red = new JSlider(0, 255, redValueNumber); redValue = GUIUtil.makeLabel("" + redValueNumber); redValue.setToolTipText("Red color component slider"); right.add(makeSlider(redLabel, red, redValue, "Red")); // green slider greenLabel = GUIUtil.makeLabel("G"); green = new JSlider(0, 255, greenValueNumber); greenValue = GUIUtil.makeLabel("" + greenValueNumber); greenValue.setToolTipText("Green color component slider"); right.add(makeSlider(greenLabel, green, greenValue, "Green")); // blue slider blueLabel = GUIUtil.makeLabel("B"); blue = new JSlider(0, 255, blueValueNumber); blueValue = GUIUtil.makeLabel("" + blueValueNumber); right.add(makeSlider(blueLabel, blue, blueValue, "Blue")); right.add(Box.createVerticalStrut(8)); // panel for algorithm p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // algorithm label JLabel algorithmLabel = GUIUtil.makeLabel("Algorithm: "); algorithmLabel.setDisplayedMnemonic('l'); String algorithmTip = "Resizing algorithm to use"; algorithmLabel.setToolTipText(algorithmTip); p.add(algorithmLabel); // algorithm combo box algorithm = GUIUtil.makeComboBox( new String[] {"Smooth", "Standard", "Fast", "Replicate", "Area averaging"}); algorithmLabel.setLabelFor(algorithm); algorithm.setToolTipText(algorithmTip); p.add(algorithm); // set the algorithm value from the preferences algorithm.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME)); right.add(GUIUtil.pad(p)); // panel for output format p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // format label JLabel formatLabel = GUIUtil.makeLabel("Format: "); formatLabel.setDisplayedMnemonic('f'); String formatTip = "Thumbnail output format"; formatLabel.setToolTipText(formatTip); p.add(formatLabel); // format combo box format = GUIUtil.makeComboBox(new String[] {"PNG", "JPG"}); formatLabel.setLabelFor(format); format.setToolTipText(formatTip); p.add(format); // set the format value from the preferences format.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME)); right.add(GUIUtil.pad(p)); right.add(Box.createVerticalStrut(5)); // panel for prepend string p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // prepend label JLabel prependLabel = GUIUtil.makeLabel("Prepend: "); prependLabel.setDisplayedMnemonic('e'); String prependTip = "Starting string for each thumbnail filename"; prependLabel.setToolTipText(prependTip); p.add(prependLabel); // prepend field prepend = GUIUtil.makeTextField( myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME), 4); prependLabel.setLabelFor(prepend); prepend.setToolTipText(prependTip); p.add(prepend); p.add(Box.createHorizontalStrut(5)); // append label JLabel appendLabel = GUIUtil.makeLabel("Append: "); appendLabel.setDisplayedMnemonic('a'); String appendTip = "Ending string for each thumbnail filename"; appendLabel.setToolTipText(appendTip); p.add(appendLabel); // append field append = GUIUtil.makeTextField( myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME), 4); appendLabel.setLabelFor(append); append.setToolTipText(appendTip); p.add(append); right.add(GUIUtil.pad(p)); // vertical padding right.add(Box.createVerticalGlue()); // bottom panel JPanel bottom = new JPanel(); bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS)); pane.add(bottom); // output folder label JLabel outputLabel = GUIUtil.makeLabel("Output folder: "); outputLabel.setDisplayedMnemonic('o'); String outputTip = "Thumbnail output folder"; outputLabel.setToolTipText(outputTip); bottom.add(outputLabel); // output folder field String filePath = new File(myPrefs.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME)) .getAbsolutePath(); output = GUIUtil.makeTextField(filePath, 8); outputLabel.setLabelFor(output); output.setToolTipText(outputTip); // start this in default and then lock down so "..." is used output.setEditable(false); output.setBackground(Color.LIGHT_GRAY); bottom.add(output); // add a file chooser button "..." dotDotDot = new JButton("..."); dotDotDot.setMnemonic('.'); dotDotDot.setToolTipText("Select destination directory."); dotDotDot.addActionListener(this); bottom.add(dotDotDot); right.add(GUIUtil.pad(p)); setFromPreferences(); addWindowListener(this); }
private void initComponents() { setPreferredSize(new java.awt.Dimension(420, 65)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); JPanel textPanel = new JPanel(); SpringLayout textLayout = new SpringLayout(); textPanel.setLayout(textLayout); this.add(buttonPanel); this.add(textPanel); // button area abortButton_ = new JButton(); abortButton_.setBackground(new java.awt.Color(255, 255, 255)); abortButton_.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/micromanager/icons/cancel.png"))); // NOI18N abortButton_.setToolTipText("Abort acquisition"); abortButton_.setFocusable(false); abortButton_.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); abortButton_.setMaximumSize(new java.awt.Dimension(30, 28)); abortButton_.setMinimumSize(new java.awt.Dimension(30, 28)); abortButton_.setPreferredSize(new java.awt.Dimension(30, 28)); abortButton_.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); abortButton_.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "abort"); } catch (Exception ex) { ReportingUtils.showError( "Couldn't abort. Try pressing stop on Multi-Dimensional acquisition Window"); } } }); buttonPanel.add(abortButton_); pauseButton_ = new JButton(); pauseButton_.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N pauseButton_.setToolTipText("Pause acquisition"); pauseButton_.setFocusable(false); pauseButton_.setMargin(new java.awt.Insets(0, 0, 0, 0)); pauseButton_.setMaximumSize(new java.awt.Dimension(30, 28)); pauseButton_.setMinimumSize(new java.awt.Dimension(30, 28)); pauseButton_.setPreferredSize(new java.awt.Dimension(30, 28)); pauseButton_.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "pause"); } catch (Exception ex) { ReportingUtils.showError("Couldn't pause"); } if (eng_.isPaused()) { pauseButton_.setIcon( new javax.swing.ImageIcon( getClass() .getResource("/org/micromanager/icons/resultset_next.png"))); // NOI18N } else { pauseButton_.setIcon( new javax.swing.ImageIcon( getClass() .getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N } } }); buttonPanel.add(pauseButton_); gridXSpinner_ = new JSpinner(); gridXSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1)); gridXSpinner_.setPreferredSize(new Dimension(35, 24)); gridYSpinner_ = new JSpinner(); gridYSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1)); gridYSpinner_.setPreferredSize(new Dimension(35, 24)); gridXSpinner_.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { gridSizeChanged(); } }); gridYSpinner_.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { gridSizeChanged(); } }); final JLabel gridLabel = new JLabel(" grid"); final JLabel byLabel = new JLabel("by"); gridLabel.setEnabled(false); byLabel.setEnabled(false); gridXSpinner_.setEnabled(false); gridYSpinner_.setEnabled(false); final JButton createGridButton = new JButton("Create"); createGridButton.setEnabled(false); createGridButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createGrid(); } }); newGridButton_ = new JToggleButton("New grid"); buttonPanel.add(new JLabel(" ")); buttonPanel.add(newGridButton_); newGridButton_.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (newGridButton_.isSelected()) { makeGridOverlay( vad_.getImagePlus().getWidth() / 2, vad_.getImagePlus().getHeight() / 2); newGridButton_.setText("Cancel"); gridLabel.setEnabled(true); byLabel.setEnabled(true); gridXSpinner_.setEnabled(true); gridYSpinner_.setEnabled(true); createGridButton.setEnabled(true); } else { vad_.getImagePlus().getOverlay().clear(); vad_.getImagePlus().getCanvas().repaint(); newGridButton_.setText("New grid"); gridLabel.setEnabled(false); byLabel.setEnabled(false); gridXSpinner_.setEnabled(false); gridYSpinner_.setEnabled(false); createGridButton.setEnabled(false); } } }); buttonPanel.add(gridXSpinner_); buttonPanel.add(byLabel); buttonPanel.add(gridYSpinner_); buttonPanel.add(gridLabel); buttonPanel.add(createGridButton); // text area zPosLabel_ = new JLabel("Z position: "); textPanel.add(zPosLabel_); timeStampLabel_ = new JLabel("Elapsed time: "); textPanel.add(timeStampLabel_); fpsField_ = new JTextField(); fpsField_.setText("7"); fpsField_.setToolTipText("Set the speed at which the acquisition is played back."); fpsField_.setPreferredSize(new Dimension(25, 18)); fpsField_.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { updateFPS(); } }); fpsField_.addKeyListener( new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { updateFPS(); } }); JLabel fpsLabel = new JLabel("Animation playback FPS: "); textPanel.add(fpsLabel); textPanel.add(fpsField_); textLayout.putConstraint(SpringLayout.WEST, textPanel, 0, SpringLayout.WEST, zPosLabel_); textLayout.putConstraint( SpringLayout.EAST, zPosLabel_, 0, SpringLayout.WEST, timeStampLabel_); textLayout.putConstraint(SpringLayout.EAST, timeStampLabel_, 0, SpringLayout.WEST, fpsLabel); textLayout.putConstraint(SpringLayout.EAST, fpsLabel, 0, SpringLayout.WEST, fpsField_); textLayout.putConstraint(SpringLayout.EAST, fpsField_, 0, SpringLayout.EAST, textPanel); textLayout.putConstraint(SpringLayout.NORTH, fpsField_, 0, SpringLayout.NORTH, textPanel); textLayout.putConstraint(SpringLayout.NORTH, zPosLabel_, 3, SpringLayout.NORTH, textPanel); textLayout.putConstraint( SpringLayout.NORTH, timeStampLabel_, 3, SpringLayout.NORTH, textPanel); textLayout.putConstraint(SpringLayout.NORTH, fpsLabel, 3, SpringLayout.NORTH, textPanel); }
Library() { super("Library Management"); frame = this; try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception de) { } cp = getContentPane(); cp.setLayout(null); // Adding TextArea in Panel jp1 = new JPanel(null, true); // t1=new // JTextField("|Name "+"\t\t"+" |Author"+"\t\t "+" |Publication "+"\t"+"|Issue // "+"\t"+"|Return "+"\t"+"| Cutm. Id"); // t1.setEditable(false); // t1.setBounds(0,0,600,20); // jp1.add(t1); MenuBar mb = new MenuBar(); setMenuBar(mb); Menu menu2 = new Menu("Skins"); MenuItem item4 = new MenuItem("Defualt Skin"); MenuItem item5 = new MenuItem("Metal Skin"); MenuItem item6 = new MenuItem("Modified Skin"); // item5.setSelected(true); menu2.add(item4); menu2.add(item5); menu2.add(item6); mb.add(menu2); Menu menu21 = new Menu("Backup"); MenuItem item61 = new MenuItem("Create Database Backup"); menu21.add(item61); mb.add(menu21); // Menu menu1=new Menu("About"); // MenuItem item1=new MenuItem("Help ?"); // MenuItem item2=new MenuItem("Support ?"); // MenuItem item3=new MenuItem("About Us ?"); // menu1.add(item1);menu1.add(item2);menu1.add(item3); // mb.add(menu1); Menu menu212 = new Menu("Exit"); MenuItem item612 = new MenuItem("Exit Form Library"); menu212.add(item612); mb.add(menu212); int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS; int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; Color re = new Color(122, 145, 201); mo1 = new DefaultListModel(); list1 = new JList(mo1); ml1 = new JLabel(" Book's Name"); ml1.setForeground(Color.red); ml1.setBounds(15, 0, 154, 20); list1.setBounds(15, 20, 154, 500); list1.setToolTipText("NAme of Book's Present in Database"); jp1.add(ml1); jp1.add(list1); mo2 = new DefaultListModel(); list2 = new JList(mo2); ml2 = new JLabel(" Author"); ml2.setForeground(re); ml2.setBounds(140 + 30, 0, 99, 20); list2.setToolTipText("Name of Book Author's Present in Database"); list2.setBounds(140 + 30, 20, 99, 900); jp1.add(ml2); jp1.add(list2); mo3 = new DefaultListModel(); list3 = new JList(mo3); ml3 = new JLabel(" Publication"); ml3.setForeground(re); ml3.setBounds(240 + 30, 0, 99, 20); list3.setToolTipText("Name of Book's Publication Present in Database"); list3.setBounds(240 + 30, 20, 99, 500); jp1.add(ml3); jp1.add(list3); mo4 = new DefaultListModel(); list4 = new JList(mo4); ml4 = new JLabel(" Issue Date"); ml4.setForeground(re); ml4.setBounds(340 + 30, 0, 70, 20); list4.setToolTipText("Date of Issue Present in Database"); list4.setBounds(340 + 30, 20, 70, 500); jp1.add(ml4); jp1.add(list4); mo5 = new DefaultListModel(); list5 = new JList(mo5); ml5 = new JLabel(" Return Date"); ml5.setForeground(re); ml5.setBounds(411 + 30, 0, 70, 20); list5.setToolTipText("Date of Return Present in Database"); list5.setBounds(411 + 30, 20, 70, 500); jp1.add(ml5); jp1.add(list5); mo6 = new DefaultListModel(); list6 = new JList(mo6); ml6 = new JLabel(" Cust. ID"); ml6.setForeground(re); ml6.setBounds(482 + 30, 0, 60, 20); list6.setToolTipText("ID of customer that purchase the book last time "); list6.setBounds(482 + 30, 20, 60, 500); jp1.add(ml6); jp1.add(list6); // a1=new JTextArea(); // a1.setText("|Name "+"\t\t\t"+" |Author"+"\t\t\t"+" |Publication "+"\t\t"+"|Issue // "+"\t\t"+"|Return "+"\t\t"+"| Cutm. Id"); // a1.setEditable(false); // JScrollPane scroll=new JScrollPane(a1,v,h); // scroll.setBounds(0,20,600,578); // jp1.add(scroll); for (int x = 1; x < 100; x++) { sr = new JLabel(x + "\n"); sr.setForeground(re); sr.setBounds(0, 20, 10, 500); jp1.add(sr); } // jp1.setBackground(Color.black); JScrollPane nm = new JScrollPane(jp1, v, h); nm.setBounds(10, 20, 600, 500); cp.add(nm); jp2 = new JPanel(null, true); b1 = new JButton("Add Book"); b1.setBounds(10, 10, 120, 25); jp2.add(b1); b2 = new JButton("Delete Book"); b2.setBounds(10, 45, 120, 25); jp2.add(b2); b3 = new JButton("View Book Details"); b3.setBounds(10, 80, 120, 25); jp2.add(b3); b4 = new JButton("View All Book's"); b4.setBounds(10, 115, 120, 25); jp2.add(b4); Color r = new Color(122, 145, 201); jp2.setBackground(r); jp2.setBounds(630, 20, 160, 145); cp.add(jp2); jp3 = new JPanel(null, true); t1 = new JTextField(); t1.setBounds(10, 10, 120, 20); jp3.add(t1); t1.setToolTipText("Find The Book By Book Name. It is Advaced Search System"); b5 = new JButton("Search Book Name"); b5.setBounds(05, 35, 130, 20); jp3.add(b5); // b5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,Event.CTRL_MASK)); b5.setMnemonic(KeyEvent.VK_N); JLabel lk = new JLabel("__________________________________"); lk.setForeground(Color.black); lk.setBounds(0, 50, 160, 6); jp3.add(lk); t14 = new JTextField(); t14.setBounds(10, 60, 120, 20); jp3.add(t14); t14.setToolTipText("Find The Book By Author Name. It is Advaced Search System"); b10 = new JButton("Search Author"); b10.setBounds(05, 85, 130, 20); jp3.add(b10); // b10.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_a,Event.CTRL_MASK)); b10.setMnemonic(KeyEvent.VK_N); Color r1 = new Color(122, 145, 201); jp3.setBackground(r1); jp3.setBounds(630, 180, 160, 115); cp.add(jp3); jp4 = new JPanel(null, true); b15 = new JButton("Add Customer"); b15.setBounds(10, 05, 120, 25); jp4.add(b15); b6 = new JButton("View all Cotumers"); b6.setBounds(10, 35, 120, 25); jp4.add(b6); t2 = new JTextField(); t2.setBounds(10, 65, 120, 20); t2.setToolTipText("Find The Customer Information. It is Advaced Search System"); jp4.add(t2); b7 = new JButton("Search"); b7.setBounds(05, 90, 130, 20); jp4.add(b7); b8 = new JButton("Delete Costumer"); b8.setBounds(10, 115, 120, 25); jp4.add(b8); b9 = new JButton("View Cust. Details"); b9.setBounds(10, 150, 120, 25); jp4.add(b9); Color r3 = new Color(122, 145, 201); jp4.setBackground(r3); jp4.setBounds(630, 305, 160, 180); cp.add(jp4); b_no = new JLabel(); b_no.setForeground(Color.red); b_no.setBounds(150, 0, 150, 20); cp.add(b_no); progress1 = new JProgressBar(); progress1.setBackground(re); progress1.setBounds(630, 490, 150, 25); cp.add(progress1); try { rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int count = Integer.parseInt(read1.getText()); int total = count - 1; int blk = 0; rd1.close(); for (int i = 1; i < count; i++) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { blk++; b_no.setText("Total Books = " + blk + " (Book's)"); mo1.addElement(read1.getText() + ""); rd1.close(); int per = i * 100 / total; progress1.setValue(per); rd1 = new FileReader("Database/" + i + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".issue"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { mo4.addElement(read1.getText() + ""); } else { mo4.addElement(read1.getText() + " -"); } rd1.close(); rd1 = new FileReader("Database/" + i + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } } } catch (Exception der) { a1.setText("Error Occurs: \n" + der); } // Source code for searching the book's from Database // it search book by name of book,author,publication // it work when you don't know about any thing than press any // keyword to find book/ // eg: if you have book name that publish by that publication which // starts from "c" // then you press only "c" in search it show you all Books that start // with "c" ,Author "c" and publication that start "c" . // Warning: // Don't Modify the code without knowledge of full source code // Author : Pravin Rane b5.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int bs1 = 0; progress1.setValue(0); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); ml1.setText("Book Name"); ml2.setText("Author"); ml3.setText("Publication"); ml4.setText("Issue Date"); ml5.setText("Return Date"); ml6.setText("Cust. ID."); if (!t1.getText().equals("")) { rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int no = Integer.parseInt(read1.getText()); rd1.close(); int len = t1.getText().length(); for (int k = 0; k < len; k++) { char ch = t1.getText().charAt(k); stra1 = stra1 + ch; // System.out.println(stra1+""); } for (int v = 1; v < no; v++) { name11 = ""; author11 = ""; publication11 = ""; progress1.setMaximum(no); int per = v * 100 / no; progress1.updateUI(); progress1.setValue(per); FileReader re1 = new FileReader("Database/" + v + ".name"); JTextField jt1 = new JTextField(); jt1.read(re1, null); String name = jt1.getText(); re1.close(); FileReader re2 = new FileReader("Database/" + v + ".author"); JTextField jt2 = new JTextField(); jt2.read(re2, null); String author = jt2.getText(); re2.close(); FileReader re3 = new FileReader("Database/" + v + ".publication"); JTextField jt3 = new JTextField(); jt3.read(re3, null); String publication = jt3.getText(); re3.close(); find = v; try { for (int z = 0; z < len; z++) { name11 = name11 + name.charAt(z); // author11=author11+author.charAt(z); // System.out.println(author11+""); publication11 = publication11 + publication.charAt(z); if (z == (len - 1)) { // System.out.println(name11+""); // System.out.println(publication11+""); } } } catch (Exception def) { } if (name.toLowerCase().equals(t1.getText()) || name.toUpperCase().equals(t1.getText()) || author.toLowerCase().equals(t1.getText()) || author.toUpperCase().equals(t1.getText()) || publication.toLowerCase().equals(t1.getText()) || publication.toUpperCase().equals(t1.getText())) { bs1++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } else if (publication11.toLowerCase().equals(t1.getText()) || author11.toLowerCase().equals(t1.getText()) || name11.toLowerCase().equals(t1.getText()) || publication11.toUpperCase().equals(t1.getText()) || author11.toUpperCase().equals(t1.getText()) || name11.toUpperCase().equals(t1.getText())) { bs1++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } b_no.setText("Total Book Found =" + bs1 + " (Book's)"); } } else { progress1.setValue(0); JOptionPane.showMessageDialog( (Component) null, "Please Enter the Book Name or Publcation", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); b_no.setText("User Input Error!"); } } catch (Exception der) { System.out.println("Error:" + der); } } }); b10.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int bs2 = 0; progress1.setValue(0); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); ml1.setText("Book Name"); ml2.setText("Author"); ml3.setText("Publication"); ml4.setText("Issue Date"); ml5.setText("Return Date"); ml6.setText("Cust. ID."); if (!t14.getText().equals("")) { rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int no = Integer.parseInt(read1.getText()); rd1.close(); int len = t14.getText().length(); for (int k = 0; k < len; k++) { char ch = t14.getText().charAt(k); stra1 = stra1 + ch; // System.out.println(stra1+""); } for (int v = 1; v < no; v++) { name11 = ""; author11 = ""; publication11 = ""; progress1.setMaximum(no); int per = v * 100 / no; progress1.updateUI(); progress1.setValue(per); FileReader re1 = new FileReader("Database/" + v + ".name"); JTextField jt1 = new JTextField(); jt1.read(re1, null); String name = jt1.getText(); re1.close(); FileReader re2 = new FileReader("Database/" + v + ".author"); JTextField jt2 = new JTextField(); jt2.read(re2, null); String author = jt2.getText(); re2.close(); FileReader re3 = new FileReader("Database/" + v + ".publication"); JTextField jt3 = new JTextField(); jt3.read(re3, null); String publication = jt3.getText(); re3.close(); find = v; try { for (int z = 0; z < len; z++) { // name11=name11+name.charAt(z); author11 = author11 + author.charAt(z); // System.out.println(author11+""); // publication11=publication11+publication.charAt(z); if (z == (len - 1)) { // System.out.println(name11+""); // System.out.println(publication11+""); } } } catch (Exception def) { } if (author.toLowerCase().equals(t14.getText()) || author.toUpperCase().equals(t14.getText())) { bs2++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } else if (author11.toLowerCase().equals(t14.getText()) || author11.toUpperCase().equals(t14.getText())) { bs2++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } b_no.setText("Total Book Found =" + bs2 + " (Book's)"); } } else { progress1.setValue(0); b_no.setText("User Input Error!"); JOptionPane.showMessageDialog( (Component) null, "Please Enter the Book Author name", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); } } catch (Exception der) { System.out.println("Error:" + der); } } }); // End of Serching Book // Author : Pravin Rane // it use to aplly the skins to UserInteface // there are three skins Default which is Windows Skin // Metal skin and modified skin. // apply it as oer ur requirment. // Author : Pravin H. Rane item4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception dert) { System.out.println(dert); } } }); item5.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception dert) { System.out.println(dert); } } }); item6.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception dert) { System.out.println(dert); } } }); item61.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { Date d = new Date(); int my1 = d.getDate(); int my2 = d.getMonth(); FileDialog fd = new FileDialog(frame, "Save Database Backup File (Library Management )"); fd.setMode(FileDialog.SAVE); fd.setFile("Database" + my1 + "." + my2 + ".rar"); fd.setVisible(true); String dir = fd.getDirectory(); String path = fd.getFile(); String command = "jar cvf Database1.rar Database/*.*"; Runtime r = Runtime.getRuntime(); r.exec(command); String command2 = "jar cvf Database2.rar Cust_Details/*.*"; Runtime r2 = Runtime.getRuntime(); r2.exec(command2); try { Thread.sleep(1000); } catch (Exception fr) { } String command3 = "jar cvf " + dir + path + " Database1.rar Database2.rar"; Runtime r3 = Runtime.getRuntime(); r3.exec(command3); System.out.println("Database Backup Sucessfully!"); } catch (Exception dert) { System.out.println(dert); } } }); item612.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); // End Of Applyinf Skin to UInterface // This Button show the details of Book's // that specified when the book is adding in the database // you can modify the details of book. // Author : Pravin H. Rane b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { // view v=new view(String str,string info,boolean val); } catch (Exception der) { } } }); // End of book details b15.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Addcust ad = new Addcust(); ad.setVisible(true); ad.setSize(380, 400); ad.setLocation(80, 140); } }); // it show all book's available in database // it dosn't sort book by sequensely // you can modify the code for sorting the book as per your requirement // Author : Pravin b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { addBook a = new addBook(); } }); b4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); ml1.setText("Book Name"); ml2.setText("Author"); ml3.setText("Publication"); ml4.setText("Issue Date"); ml5.setText("Return Date"); ml6.setText("Cust. ID."); int za = 0; rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int count = Integer.parseInt(read1.getText()); int total = count - 1; rd1.close(); for (int i = 1; i < count; i++) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { za++; b_no.setText("Total Books = " + za + " (Book's)"); mo1.addElement(read1.getText() + ""); rd1.close(); progress1.setMaximum(total); int per = i * 100 / total; progress1.setValue(per); rd1 = new FileReader("Database/" + i + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".issue"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { mo4.addElement(read1.getText() + ""); } else { mo4.addElement(read1.getText() + " _"); } rd1.close(); rd1 = new FileReader("Database/" + i + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); progress1.setValue(100); } } } catch (Exception der) { a1.setText("Error Occurs: \n" + der); } } }); // End of View all Book's // This source code is used to show information of all customers // Author :Pravin Rane b6.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { ml1.setText("Cust. ID"); ml2.setText("Cust. Name"); ml3.setText("Registration Date"); ml4.setText("Book Name"); ml5.setText("Purchase Date"); ml6.setText("Return Date"); int z12 = 0; mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); rd2 = new FileReader("Cust_Details/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int no = Integer.parseInt(jt2.getText()); int tt = no - 1; // b_no.setText("Total Customer's :"+tt ); for (int v = 1; v < no; v++) { rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { z12++; b_no.setText("Total Customers = " + z12); mo1.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); mo2.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".date"); jt2 = new JTextField(); jt2.read(rd2, null); mo3.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".bname"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo4.addElement(jt2.getText() + ""); } else { mo4.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo5.addElement(jt2.getText() + ""); } else { mo5.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".return"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo6.addElement(jt2.getText() + ""); } else { mo6.addElement(jt2.getText() + " _"); } rd2.close(); } } } catch (Exception ser) { System.out.println(ser); } } }); // End of showing customer's Info. b9.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int ad = list1.getSelectedIndex(); String str = (String) mo1.getElementAt(ad); System.out.println(str); cust_detail d = new cust_detail(str); d.setVisible(true); d.setSize(300, 550); d.setLocation(100, 0); } catch (Exception fr) { JOptionPane.showMessageDialog( (Component) null, "Please Select Customer ID from List of Cust. ID. ", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); try { ml1.setText("Cust. ID"); ml2.setText("Cust. Name"); ml3.setText("Registration Date"); ml4.setText("Book Name"); ml5.setText("Purchase Date"); ml6.setText("Return Date"); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); rd2 = new FileReader("Cust_Details/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int no = Integer.parseInt(jt2.getText()); for (int v = 1; v < no; v++) { rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); mo1.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); mo2.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".date"); jt2 = new JTextField(); jt2.read(rd2, null); mo3.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".bname"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo4.addElement(jt2.getText() + ""); } else { mo4.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo5.addElement(jt2.getText() + ""); } else { mo5.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".return"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo6.addElement(jt2.getText() + ""); } else { mo6.addElement(jt2.getText() + " _"); } rd2.close(); } } catch (Exception fg) { } } } }); b7.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String mysearchid = t2.getText(); try { ml1.setText("Cust. ID"); ml2.setText("Cust. Name"); ml3.setText("Registration Date"); ml4.setText("Book Name"); ml5.setText("Purchase Date"); ml6.setText("Return Date"); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); if (!t2.getText().equals("")) { rd2 = new FileReader("Cust_Details/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int no = Integer.parseInt(jt2.getText()); int len3 = t2.getText().length(); for (int v = 1; v < no; v++) { name22 = ""; int lg = 0; rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); // mo1.addElement(jt2.getText()+""); String s1 = jt2.getText(); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); // mo2.addElement(jt2.getText()+""); String s2 = jt2.getText(); rd2.close(); for (int z = 0; z < len3; z++) { name22 = name22 + s2.charAt(z); } if (s1.toLowerCase().equals(mysearchid) || s1.toUpperCase().equals(mysearchid) || s2.toLowerCase().equals(mysearchid) || s2.toUpperCase().equals(mysearchid) || name22.toUpperCase().equals(mysearchid) || name22.toLowerCase().equals(mysearchid)) { lg++; b_no.setText("Customer Found :" + lg); rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); mo1.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); mo2.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".date"); jt2 = new JTextField(); jt2.read(rd2, null); mo3.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".bname"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo4.addElement(jt2.getText() + ""); } else { mo4.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo5.addElement(jt2.getText() + ""); } else { mo5.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".return"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo6.addElement(jt2.getText() + ""); } else { mo6.addElement(jt2.getText() + " _"); } rd2.close(); } } } else { progress1.setValue(0); b_no.setText("User Input Error!"); JOptionPane.showMessageDialog( (Component) null, "Please Enter Customer Id or Name", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); } } catch (Exception de) { } } }); b2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int ad = list1.getSelectedIndex(); String str99 = (String) mo1.getElementAt(ad); try { rd2 = new FileReader("Database/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int nom = Integer.parseInt(jt2.getText()); for (int count2 = 1; count2 < nom; count2++) { rd1 = new FileReader("Database/" + count2 + ".name"); read1 = new JTextField(); read1.read(rd1, null); rd1.close(); if (read1.getText().equals(str99)) { wr1 = new FileWriter("Database/" + count2 + ".name"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".author"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".publication"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".issue"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".return"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".detail"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".id"); wr1.write(""); wr1.close(); try { Library lbc = new Library(); setVisible(false); lbc.setVisible(true); lbc.setSize(800, 600); } catch (Exception de) { } } } } catch (Exception fr) { System.out.println(fr); } } }); b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int ad = list1.getSelectedIndex(); String str34 = (String) mo1.getElementAt(ad); jf55 = new JFrame("Book Details"); jf55.setVisible(true); jf55.setLayout(null); jf55.setLocation(160, 180); JTextArea ak47 = new JTextArea(); ak47.setEditable(false); ak47.setText( "Book Details" + "\n" + "**************************************************"); ak47.setBounds(10, 10, 250, 250); jf55.add(ak47); Button b1 = new Button("Ok"); b1.setBounds(80, 270, 100, 25); jf55.add(b1); b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jf55.setVisible(false); } }); jf55.setSize(285, 335); rd2 = new FileReader("Database/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int nov = Integer.parseInt(jt2.getText()); for (int i = 1; i < nov; i++) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); String hj = read1.getText(); rd1.close(); if (hj.equals(str34)) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { ak47.setText(ak47.getText() + "\n" + "Book Name :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".author"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Book Author :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".publication"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Book Publication :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".issue"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { ak47.setText(ak47.getText() + "\n" + "Issue Date :" + read1.getText()); } else { ak47.setText(ak47.getText() + "\n" + "Issue Date : None"); } rd1.close(); rd1 = new FileReader("Database/" + i + ".return"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Return Date :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".id"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Cust. Id :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".detail"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { ak47.setText(ak47.getText() + "\n" + "Other Details : \n" + read1.getText()); } else { ak47.setText(ak47.getText() + "\n" + "Other Details : Not Found"); } rd1.close(); } } } } catch (Exception de) { JOptionPane.showMessageDialog( (Component) null, "Please Select Book Name from List", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); } } }); }
/** Construct the TV object - that is, the main GUI for the program */ public TV(JFrame f, TD mod) { super(); frm = f; theTD = mod; JButton b; // Build the GUI toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.getAccessibleContext().setAccessibleName("File Toolbar"); toolBar.addSeparator(); b = addTool(toolBar, "Cut"); b = addTool(toolBar, "Copy"); b = addTool(toolBar, "Paste"); toolBar.addSeparator(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.FALSE); // The Slider numSlider = new JSlider(JSlider.HORIZONTAL, 1, 40, 1); numSlider.setPaintTicks(true); numSlider.setPaintLabels(false); numSlider.setMajorTickSpacing(10); numSlider.setMinorTickSpacing(2); numSlider.setExtent(1); numSlider.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent ce) { // System.out.println("CHANGE: " + ce); setQNumber(((JSlider) (ce.getSource())).getValue()); } }); numSlider.setToolTipText("Slide to select question by number"); toolBar.add(numSlider); // The Question# textfield toolBar.add(numTF = new JTextField("01")); numTF.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String num = ((JTextField) e.getSource()).getText(); int n = Integer.parseInt(num.trim()); setQNumber(n); } }); numTF.setToolTipText("Type number to select question by number"); // The First Button b = addTool(toolBar, "First"); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setQNumber(1); } }); // The Previous Button b = addTool(toolBar, "Previous"); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (getQNumber() <= 1) return; setQNumber(getQNumber() - 1); } }); // The Next Button b = addTool(toolBar, "Next"); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (getQNumber() >= getNumQuestions()) return; setQNumber(getQNumber() + 1); } }); // The "Last" Button b = addTool(toolBar, "Last"); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setQNumber(getNumQuestions()); } }); add(BorderLayout.NORTH, toolBar); // Rest is a panel to hold the questions, one at a time. questionsPanel = new JPanel(); questionsPanel.setLayout(myCardLayout = new CardLayout()); add(BorderLayout.SOUTH, questionsPanel); fc = new FileDialog(frm); fc.setFilenameFilter( new FilenameFilter() { public boolean accept(File ff, String fname) { // System.out.println("accept("+fname+")"); // XXX TODO list of extentions, from properties. return fname.endsWith(".xam"); } }); TV.centre(fc); }
public UReservacion(String i, String n, String a, String c) { this.Identificacion = i; this.Nombre = n; this.Apellido = a; this.Correo = c; setTitle("Sistema de Registro"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); esquema = new BorderLayout(); panelnorte = new JPanel(); panelcentro = new JPanel(new BorderLayout()); panelBusqueda = new JPanel(new FlowLayout()); panelsur = new JPanel(); dtmesa = mesa.listarMesa(""); String[] columNames = {"Numero", "Capacidad", "Fumador", "Estado"}; dtmMesa = new DefaultTableModel(dtmesa, columNames); jtbMesa = new JTable(dtmMesa); jtbMesa.setEnabled(false); jtbMesa.setPreferredScrollableViewportSize(new Dimension(700, 120)); jtbMesa.setAutoCreateRowSorter(true); spMesa = new JScrollPane(jtbMesa); lbltitulo = new JLabel("Mesas disponibles"); lbltitulo.setFont(new Font("Verdana", Font.BOLD, 14)); lblnomproducto = new JLabel("Ingrese numero de mesa:"); txtNumMesa = new JTextField(5); btnRegistrar = new JButton("Registrar"); panelBusqueda.add(lblnomproducto); panelBusqueda.add(txtNumMesa); lblAcompaantes = new JLabel("Personas:"); panelBusqueda.add(lblAcompaantes); textCompa = new JTextField(); panelBusqueda.add(textCompa); textCompa.setColumns(5); lblNewLabel_1 = new JLabel("Fecha"); panelBusqueda.add(lblNewLabel_1); txtAaaammdd = new JTextField(); txtAaaammdd.setText("AAAA-MM-DD"); txtAaaammdd.setToolTipText(""); panelBusqueda.add(txtAaaammdd); txtAaaammdd.setColumns(10); lblHora = new JLabel("Hora"); panelBusqueda.add(lblHora); txtHhmmss = new JTextField(); txtHhmmss.setText("HH-MM-SS"); panelBusqueda.add(txtHhmmss); txtHhmmss.setColumns(10); lblNewLabel = new JLabel("¿Vista al mar?"); panelBusqueda.add(lblNewLabel); checkBox = new JCheckBox(""); checkBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { checkBox.setEnabled(false); } }); panelBusqueda.add(checkBox); panelBusqueda.add(btnRegistrar); getContentPane().setLayout(esquema); panelnorte.add(lbltitulo); panelcentro.add(panelBusqueda, BorderLayout.NORTH); panelcentro.add(spMesa, BorderLayout.CENTER); getContentPane().add(panelnorte, BorderLayout.NORTH); getContentPane().add(panelcentro, BorderLayout.CENTER); getContentPane().add(panelsur, BorderLayout.SOUTH); this.pack(); setResizable(false); setLocationRelativeTo(this.getParent()); setVisible(true); mostrarProductos("Libre"); }