List of usage examples for javax.swing Box createHorizontalGlue
public static Component createHorizontalGlue()
From source file:verdandi.ui.settings.DefaultSettingsPanel.java
private JPanel getAnnotatedWorkRecordViewPrefs() { JPanel res = new JPanel(); res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.annotatedworkview.title"))); res.setLayout(new BoxLayout(res, BoxLayout.LINE_AXIS)); initAnnotatedWorkRecordsOnStartup = new JCheckBox( RC.getString("settingseditor.annotatedworkview.doinitonstartup")); boolean selected = conf.getString(AnnotatedWorkRecordView.PREF_RESTORE_ON_INIT, "false") .equalsIgnoreCase("true"); initAnnotatedWorkRecordsOnStartup.setSelected(selected); res.add(Box.createHorizontalStrut(5)); res.add(initAnnotatedWorkRecordsOnStartup); res.add(Box.createHorizontalGlue()); return res;/*from w ww. ja va 2s . c o m*/ }
From source file:medsavant.uhn.cancer.UserCommentApp.java
private JPanel getOntologyTitlePanel(final VariantRecord vr, final OntologyTerm ot) { String header = ot.getID() + " - " + ot.getName(); //ontology title. JPanel ontologyTitlePanel = new JPanel(); ontologyTitlePanel.setLayout(new BoxLayout(ontologyTitlePanel, BoxLayout.X_AXIS)); ontologyTitlePanel.add(new JLabel(header)); ontologyTitlePanel.add(Box.createHorizontalGlue()); JButton replyToOntologyButton = new JButton(new ImageIcon(REPLY_TO_ONTOLOGY_ICON.getImage() .getScaledInstance(ICON_WIDTH, ICON_HEIGHT, java.awt.Image.SCALE_SMOOTH))); replyToOntologyButton.addActionListener(new ActionListener() { @Override/*from w w w . j a v a2s . c om*/ public void actionPerformed(ActionEvent ae) { replyToOntology(vr, ot); } }); ontologyTitlePanel.add(replyToOntologyButton); return ontologyTitlePanel; }
From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java
/** * Constructs DBMenuBar. Adds the menu and menuitems. * * @param graphicsRunner the JFrame that created this * @param desktop the DBDesktopPane in the JFrame *//*from ww w. j a va 2 s .co m*/ public DBMenuBar(GraphicsRunner graphicsRunner, DBDesktopPane desktop) { super(); gr = graphicsRunner; this.desktop = desktop; //Set up the menu JMenu menu = new JMenu("File"); add(menu); //Set up the menu items. JMenuItem menuItem = new JMenuItem("New"); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("new"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Open"); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("open"); menuItem.addActionListener(this); menuItem.setLayout(new MigLayout()); menu.add(menuItem); menuItem = new JMenuItem("Save"); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("save"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Save As"); menuItem.setActionCommand("saveas"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Current Page"); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("printpage"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Show"); menuItem.setActionCommand("printshow"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Dot Sheets"); menuItem.setActionCommand("printdotsheets"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Quit"); menuItem.setMnemonic(KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("quit"); menuItem.addActionListener(this); menu.add(menuItem); menu = new JMenu("Edit"); add(menu); menuItem = new JMenuItem("Undo"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("undo"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Redo"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("redo"); menuItem.addActionListener(this); menu.add(menuItem); menu = new JMenu("Settings"); add(menu); menuItem = new JMenuItem("Toggle Gridlines"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("togglegrid"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowGrid() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Toggle Dot Names"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("togglenames"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowNames() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Toggle Text Box"); menuItem.setActionCommand("toggletext"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowText() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Color Code Dots by Instrument"); menuItem.setActionCommand("colordots"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldColorDots() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem(); menuItem.setText(Main.getState().getSettings().useCollegeHashes() ? "Change to High School Hashes" : "Change to College Hashes"); menuItem.setActionCommand("changehash"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Change Font Size"); menuItem.setActionCommand("fontsize"); menuItem.addActionListener(this); menu.add(menuItem); //add(Box.createHorizontalStrut(menu.getPreferredSize().width)); //add these to the menubar itself menuItem = new JMenuItem("Play"); menuItem.setMaximumSize(new Dimension(menuItem.getPreferredSize().width, Integer.MAX_VALUE)); menuItem.setActionCommand("play"); menuItem.addActionListener(this); add(menuItem); add(Box.createHorizontalGlue()); menu = new JMenu("Help"); add(menu); menuItem = new JMenuItem("Help"); menuItem.setActionCommand("help"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("About"); menuItem.setActionCommand("about"); menuItem.addActionListener(this); menu.add(menuItem); }
From source file:es.emergya.ui.gis.popups.SummaryDialog.java
public SummaryDialog(Recurso r) { super();// w ww . j a v a 2s .c o m r = (r == null) ? null : RecursoConsultas.getByIdentificador(r.getIdentificador()); setAlwaysOnTop(true); setResizable(false); setName(r.getIdentificador()); setBackground(Color.WHITE); setSize(600, 400); setTitle(i18n.getString("Resources.summary.titleWindow") + " " + r.getIdentificador()); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getIconImage()); } catch (Throwable e) { LOG.error("There is no icon image", e); } JPanel base = new JPanel(); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); base.setBackground(Color.WHITE); r = RecursoConsultas.getByIdentificador(r.getIdentificador()); // Icono del titulo JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING)); final JLabel labelTitle = new JLabel(i18n.getString("Resources.summary.title") + " " + r.getIdentificador(), LogicConstants.getIcon("tittleficha_icon_recurso"), JLabel.LEFT); labelTitle.setFont(LogicConstants.deriveBoldFont(12f)); title.setBackground(Color.WHITE); title.add(labelTitle); base.add(title); // Nombre JPanel mid = new JPanel(new SpringLayout()); mid.setBackground(Color.WHITE); mid.add(new JLabel(i18n.getString("Resources.name"), JLabel.RIGHT)); JTextField name = new JTextField(25); if (r != null) name.setText(r.getIdentificador()); name.setEditable(false); mid.add(name); // Patrulla mid.add(new JLabel(i18n.getString("Resources.squad"), JLabel.RIGHT)); // JComboBox squads = new // JComboBox(PatrullaConsultas.getAll().toArray()); JTextField squads = new JTextField(r.getPatrullas() == null ? null : r.getPatrullas().getNombre()); // squads.setSelectedItem(r.getPatrullas()); squads.setEditable(false); squads.setColumns(21); // squads.setEnabled(false); mid.add(squads); // Tipo mid.add(new JLabel(i18n.getString("Resources.type"), JLabel.RIGHT)); JTextField types = new JTextField(r.getTipo()); types.setEditable(false); mid.add(types); // Estado Eurocop mid.add(new JLabel(i18n.getString("Resources.status"), JLabel.RIGHT)); JTextField status = new JTextField(); if (r.getEstadoEurocop() != null) status.setText(r.getEstadoEurocop().getIdentificador()); status.setEditable(false); mid.add(status); // Subflota mid.add(new JLabel(i18n.getString("Resources.subfleet"), JLabel.RIGHT)); JTextField subfleets = new JTextField(r.getFlotas() == null ? null : r.getFlotas().getNombre()); subfleets.setEditable(false); mid.add(subfleets); // Referencia Humana mid.add(new JLabel(i18n.getString("Resources.incidences"), JLabel.RIGHT)); JTextField rHumana = new JTextField(); // if (r.getIncidencias() != null) // rHumana.setText(r.getIncidencias().getReferenciaHumana()); rHumana.setEditable(false); mid.add(rHumana); // dispositivo mid.add(new JLabel(i18n.getString("Resources.device"), JLabel.RIGHT)); JTextField issi = new JTextField(); issi.setEditable(false); mid.add(issi); mid.add(new JLabel(i18n.getString("Resources.enabled"), JLabel.RIGHT)); JCheckBox enabled = new JCheckBox("", true); enabled.setEnabled(false); enabled.setOpaque(false); if (r.getDispositivo() != null) { final String valueOf = String.valueOf(r.getDispositivo()); try { issi.setText(String.format(FORMAT, r.getDispositivo())); } catch (Throwable t) { issi.setText(valueOf); } enabled.setSelected(r.getHabilitado()); } mid.add(enabled); // Fecha ultimo gps mid.add(new JLabel(i18n.getString("Resources.lastPosition"), JLabel.RIGHT)); JTextField lastGPS = new JTextField(); final Date lastGPSDateForRecurso = HistoricoGPSConsultas.lastGPSDateForRecurso(r); if (lastGPSDateForRecurso != null) { lastGPS.setText(SimpleDateFormat.getDateTimeInstance().format(lastGPSDateForRecurso)); } lastGPS.setEditable(false); mid.add(lastGPS); // Espacio en blanco mid.add(Box.createHorizontalGlue()); mid.add(Box.createHorizontalGlue()); // Espacio en blanco mid.add(Box.createHorizontalGlue()); mid.add(Box.createHorizontalGlue()); SpringUtilities.makeCompactGrid(mid, 5, 4, 6, 6, 6, 18); base.add(mid); // informacion adicional JPanel infoPanel = new JPanel(new SpringLayout()); JTextField info = new JTextField(25); info.setText(r.getInfoAdicional()); info.setEditable(false); infoPanel.setOpaque(false); infoPanel.add(new JLabel(i18n.getString("Resources.info"))); infoPanel.add(info); SpringUtilities.makeCompactGrid(infoPanel, 1, 2, 6, 6, 6, 18); base.add(infoPanel); JPanel buttons = new JPanel(); buttons.setBackground(Color.WHITE); JButton accept = new JButton(i18n.getString("Buttons.ok"), LogicConstants.getIcon("button_accept")); accept.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); buttons.add(accept); base.add(buttons); getContentPane().add(base); pack(); int x; int y; Container myParent; try { myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getContentPane(); java.awt.Point topLeft = myParent.getLocationOnScreen(); Dimension parentSize = myParent.getSize(); Dimension mySize = getSize(); if (parentSize.width > mySize.width) x = ((parentSize.width - mySize.width) / 2) + topLeft.x; else x = topLeft.x; if (parentSize.height > mySize.height) y = ((parentSize.height - mySize.height) / 2) + topLeft.y; else y = topLeft.y; setLocation(x, y); } catch (Throwable e1) { LOG.error("There is no basic window!", e1); } }
From source file:es.emergya.ui.gis.popups.SDSDialog.java
public SDSDialog(Recurso r) { super();//from w w w . j a v a 2 s.c o m setAlwaysOnTop(true); setResizable(false); iconTransparente = LogicConstants.getIcon("48x48_transparente"); iconEnviando = LogicConstants.getIcon("anim_enviando"); destino = r; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosing(e); cancel.doClick(); } }); // setPreferredSize(new Dimension(400, 150)); setTitle(i18n.getString("window.sds.titleBar") + " " + r.getIdentificador()); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getIconImage()); } catch (Throwable e) { LOG.error("There is no icon image", e); } JPanel base = new JPanel(); base.setBackground(Color.WHITE); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); // Icono del titulo JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING)); final JLabel titleLabel = new JLabel(i18n.getString("window.sds.title"), LogicConstants.getIcon("tittleventana_icon_enviarsds"), JLabel.LEFT); titleLabel.setFont(LogicConstants.deriveBoldFont(12f)); title.add(titleLabel); title.setOpaque(false); base.add(title); // Espacio para el mensaje sds = new JTextArea(7, 40); sds.setLineWrap(true); final JScrollPane sdsp = new JScrollPane(sds); sdsp.setOpaque(false); sdsp.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.BLACK), i18n.getString("Admin.message") + "\t (0/" + maxChars + ")")); sds.setDocument(new PlainDocument() { @Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (this.getLength() + str.length() <= maxChars) { super.insertString(offs, str, a); } } }); sds.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateChars(e); } @Override public void insertUpdate(DocumentEvent e) { updateChars(e); } @Override public void changedUpdate(DocumentEvent e) { updateChars(e); } private void updateChars(DocumentEvent e) { ((TitledBorder) sdsp.getBorder()).setTitle( i18n.getString("Admin.message") + "\t (" + sds.getText().length() + "/" + maxChars + ")"); sdsp.repaint(); send.setEnabled(!sds.getText().isEmpty()); notification.setForeground(Color.WHITE); notification.setText("PLACEHOLDER"); } }); base.add(sdsp); // Area para mensajes JPanel notificationArea = new JPanel(); notificationArea.setOpaque(false); notification = new JLabel("TEXT"); notification.setForeground(Color.WHITE); notificationArea.add(notification); base.add(notificationArea); JPanel buttons = new JPanel(); buttons.setOpaque(false); buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS)); send = new JButton(i18n.getString("Buttons.send"), LogicConstants.getIcon("ventanacontextual_button_enviarsds")); send.addActionListener(this); send.setEnabled(false); buttons.add(send); buttons.add(Box.createHorizontalGlue()); progressIcon = new JLabel(iconTransparente); buttons.add(progressIcon); buttons.add(Box.createHorizontalGlue()); cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel")); cancel.addActionListener(this); buttons.add(cancel); base.add(buttons); getContentPane().add(base); pack(); int x; int y; Container myParent; try { myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getContentPane(); java.awt.Point topLeft = myParent.getLocationOnScreen(); Dimension parentSize = myParent.getSize(); Dimension mySize = getSize(); if (parentSize.width > mySize.width) x = ((parentSize.width - mySize.width) / 2) + topLeft.x; else x = topLeft.x; if (parentSize.height > mySize.height) y = ((parentSize.height - mySize.height) / 2) + topLeft.y; else y = topLeft.y; setLocation(x, y); } catch (Throwable e1) { LOG.error("There is no basic window!", e1); } this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent arg0) { deleteErrorMessage(); } @Override public void windowClosed(WindowEvent arg0) { deleteErrorMessage(); } private void deleteErrorMessage() { SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() { @Override protected Object doInBackground() throws Exception { if (bandejaSalida != null) { MessageGenerator.remove(bandejaSalida.getId()); } bandejaSalida = null; return null; } @Override protected void done() { super.done(); SDSDialog.this.sds.setText(""); SDSDialog.this.sds.setEnabled(true); SDSDialog.this.sds.repaint(); SDSDialog.this.progressIcon.setIcon(iconTransparente); SDSDialog.this.progressIcon.repaint(); SDSDialog.this.notification.setText(""); SDSDialog.this.notification.repaint(); } }; sw.execute(); } }); }
From source file:com.gdc.nms.web.mibquery.wizard.ciscavate.cjwizard.WizardContainer.java
/** * // w w w.j a v a 2 s . c o m */ private void initComponents() { final JButton prevBtn = new JButton(_prevAction); final JButton nextBtn = new JButton(_nextAction); final JButton finishBtn = new JButton(_finishAction); final JButton cancelBtn = new JButton(_cancelAction); _extraButtonPanel = new JPanel(); _extraButtonPanel.setLayout(new BoxLayout(_extraButtonPanel, BoxLayout.LINE_AXIS)); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(_extraButtonPanel); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(prevBtn); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(nextBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(finishBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(cancelBtn); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15)); //this.setLayout(new BorderLayout()); //this.add(_template, BorderLayout.CENTER); //this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:com.github.cjwizard.WizardContainer.java
/** * //from ww w. j a v a 2 s .com */ private void initComponents() { final JButton prevBtn = new JButton(_prevAction); final JButton nextBtn = new JButton(_nextAction); final JButton finishBtn = new JButton(_finishAction); final JButton cancelBtn = new JButton(_cancelAction); _extraButtonPanel = new JPanel(); _extraButtonPanel.setLayout(new BoxLayout(_extraButtonPanel, BoxLayout.LINE_AXIS)); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(_extraButtonPanel); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(prevBtn); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(nextBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(finishBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(cancelBtn); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15)); this.setLayout(new BorderLayout()); this.add(_template, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:ome.formats.importer.gui.FileQueueTable.java
/** * Set up and display the file queue table *//*from www.j a v a 2 s. c o m*/ FileQueueTable() { // ----- Variables ----- // Debug Borders Boolean debugBorders = false; // Size of the add/remove/refresh buttons (which are square). int buttonSize = 40; // Add graphic for the refresh button //String refreshIcon = "gfx/recycled.png"; // Add graphic for add button String addIcon = "gfx/add.png"; // Remove graphics for remove button String removeIcon = "gfx/remove.png"; // Width of the status columns int statusWidth = 100; // ----- GUI Layout Elements ----- // Start layout here setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); setBorder(BorderFactory.createEmptyBorder(6, 5, 9, 8)); JPanel buttonPanel = new JPanel(); if (debugBorders == true) buttonPanel.setBorder(BorderFactory.createLineBorder(Color.red, 1)); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS)); // refreshBtn = addButton("+", refreshIcon, null); // refreshBtn.setMaximumSize(new Dimension(buttonSize, buttonSize)); // refreshBtn.setPreferredSize(new Dimension(buttonSize, buttonSize)); // refreshBtn.setMinimumSize(new Dimension(buttonSize, buttonSize)); // refreshBtn.setSize(new Dimension(buttonSize, buttonSize)); // refreshBtn.setActionCommand(Actions.REFRESH); // refreshBtn.addActionListener(this); addBtn = GuiCommonElements.addBasicButton(null, addIcon, null); addBtn.setMaximumSize(new Dimension(buttonSize, buttonSize)); addBtn.setPreferredSize(new Dimension(buttonSize, buttonSize)); addBtn.setMinimumSize(new Dimension(buttonSize, buttonSize)); addBtn.setSize(new Dimension(buttonSize, buttonSize)); addBtn.setActionCommand(FileQueueHandler.ADD); addBtn.addActionListener(this); addBtn.setToolTipText("Add files to the import queue."); removeBtn = GuiCommonElements.addBasicButton(null, removeIcon, null); removeBtn.setMaximumSize(new Dimension(buttonSize, buttonSize)); removeBtn.setPreferredSize(new Dimension(buttonSize, buttonSize)); removeBtn.setMinimumSize(new Dimension(buttonSize, buttonSize)); removeBtn.setSize(new Dimension(buttonSize, buttonSize)); removeBtn.setActionCommand(FileQueueHandler.REMOVE); removeBtn.addActionListener(this); removeBtn.setToolTipText("Remove files from the import queue."); buttonPanel.add(Box.createRigidArea(new Dimension(0, 60))); //buttonPanel.add(refreshBtn); buttonPanel.add(Box.createVerticalGlue()); buttonPanel.add(addBtn); buttonPanel.add(Box.createRigidArea(new Dimension(0, 5))); buttonPanel.add(removeBtn); buttonPanel.add(Box.createVerticalGlue()); buttonPanel.add(Box.createRigidArea(new Dimension(0, 60))); add(buttonPanel); add(Box.createRigidArea(new Dimension(5, 0))); JPanel queuePanel = new JPanel(); if (debugBorders == true) queuePanel.setBorder(BorderFactory.createLineBorder(Color.red, 1)); queuePanel.setLayout(new BoxLayout(queuePanel, BoxLayout.PAGE_AXIS)); //queuePanel.add(Box.createRigidArea(new Dimension(0,10))); JPanel labelPanel = new JPanel(); labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.LINE_AXIS)); JLabel label = new JLabel("Import Queue:"); labelPanel.add(label); labelPanel.add(Box.createHorizontalGlue()); groupBtn = GuiCommonElements.addBasicButton("Group: ", null, "Current Group"); groupBtn.setToolTipText("The user group you are logged into."); //groupBtn.setEnabled(false); labelPanel.add(groupBtn); queuePanel.add(labelPanel); queuePanel.add(Box.createRigidArea(new Dimension(0, 5))); TableColumnModel cModel = getQueue().getColumnModel(); headerCellRenderer = new MyTableHeaderRenderer(); fileCellRenderer = new LeftDotRenderer(); dpCellRenderer = new CenterTextRenderer(); statusCellRenderer = new CenterTextRenderer(); // Create a custom header for the table cModel.getColumn(0).setHeaderRenderer(headerCellRenderer); cModel.getColumn(1).setHeaderRenderer(headerCellRenderer); cModel.getColumn(2).setHeaderRenderer(headerCellRenderer); cModel.getColumn(0).setCellRenderer(fileCellRenderer); cModel.getColumn(1).setCellRenderer(dpCellRenderer); cModel.getColumn(2).setCellRenderer(statusCellRenderer); // Set the width of the status column TableColumn statusColumn = getQueue().getColumnModel().getColumn(2); statusColumn.setPreferredWidth(statusWidth); statusColumn.setMaxWidth(statusWidth); statusColumn.setMinWidth(statusWidth); SelectionListener listener = new SelectionListener(getQueue()); getQueue().getSelectionModel().addListSelectionListener(listener); //queue.getColumnModel().getSelectionModel() // .addListSelectionListener(listener); // Hide 3rd to 6th columns TableColumnModel tcm = getQueue().getColumnModel(); TableColumn projectColumn = tcm.getColumn(6); tcm.removeColumn(projectColumn); TableColumn userPixelColumn = tcm.getColumn(6); tcm.removeColumn(userPixelColumn); TableColumn userSpecifiedNameColumn = tcm.getColumn(6); tcm.removeColumn(userSpecifiedNameColumn); TableColumn datasetColumn = tcm.getColumn(3); tcm.removeColumn(datasetColumn); TableColumn pathColumn = tcm.getColumn(3); tcm.removeColumn(pathColumn); TableColumn archiveColumn = tcm.getColumn(3); tcm.removeColumn(archiveColumn); // Add the table to the scollpane JScrollPane scrollPane = new JScrollPane(getQueue()); queuePanel.add(scrollPane); JPanel importPanel = new JPanel(); importPanel.setLayout(new BoxLayout(importPanel, BoxLayout.LINE_AXIS)); clearDoneBtn = GuiCommonElements.addBasicButton("Clear Done", null, null); clearFailedBtn = GuiCommonElements.addBasicButton("Clear Failed", null, null); importBtn = GuiCommonElements.addBasicButton("Import", null, null); importPanel.add(Box.createHorizontalGlue()); importPanel.add(clearDoneBtn); clearDoneBtn.setEnabled(false); clearDoneBtn.setActionCommand(FileQueueHandler.CLEARDONE); clearDoneBtn.addActionListener(this); clearDoneBtn.setToolTipText("Clear all 'done' entries from the import queue."); importPanel.add(Box.createRigidArea(new Dimension(0, 5))); importPanel.add(clearFailedBtn); clearFailedBtn.setEnabled(false); clearFailedBtn.setActionCommand(FileQueueHandler.CLEARFAILED); clearFailedBtn.addActionListener(this); clearFailedBtn.setToolTipText("Clear all 'failed' entries from the import queue."); importPanel.add(Box.createRigidArea(new Dimension(0, 10))); importPanel.add(importBtn); importBtn.setEnabled(false); importBtn.setActionCommand(FileQueueHandler.IMPORT); importBtn.addActionListener(this); importBtn.setToolTipText("Begin importing files."); GuiCommonElements.enterPressesWhenFocused(importBtn); queuePanel.add(Box.createRigidArea(new Dimension(0, 5))); queuePanel.add(importPanel); add(queuePanel); }
From source file:es.emergya.ui.plugins.forms.FormGeneric.java
protected void addString(String texto, String label) { rows++;//w w w . jav a 2 s . c o m mid.add(new JLabel(i18n.getString(label), JLabel.RIGHT)); JTextField jtextField = new JTextField(texto); jtextField.setName(label); jtextField.setEditable(true); componentes.add(jtextField); mid.add(jtextField); for (int i = 2; i < cols; i++) mid.add(Box.createHorizontalGlue()); }
From source file:es.emergya.ui.gis.popups.RouteDialog.java
private RouteDialog() { super();/* w w w .ja v a 2 s . co m*/ setAlwaysOnTop(true); setResizable(false); iconTransparente = LogicConstants.getIcon("48x48_transparente"); iconEnviando = LogicConstants.getIcon("anim_calculando"); try { route = new OsmDataLayer(new DataSet(), "route", File.createTempFile("route", "route")); } catch (IOException e) { log.error(e.getMessage(), e); } setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { clear.doClick(); setVisible(false); } }); setTitle(i18n.getString("window.route.titleBar")); setMinimumSize(new Dimension(400, 200)); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getIconImage()); } catch (Throwable e) { LOG.error("There is no icon image", e); } JPanel base = new JPanel(); base.setBackground(Color.WHITE); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); // Icono del titulo JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING)); title.setOpaque(false); final JLabel labelTitle = new JLabel(i18n.getString("window.route.title"), LogicConstants.getIcon("tittleventana_icon_calcularruta"), JLabel.LEFT); labelTitle.setFont(LogicConstants.deriveBoldFont(12.0f)); title.add(labelTitle); base.add(title); JPanel content = new JPanel(new SpringLayout()); content.setOpaque(false); // Coordenadas content.add(new JLabel(i18n.getString("window.route.origen"), JLabel.LEFT)); JPanel coords = new JPanel(new GridLayout(1, 2)); coords.setOpaque(false); fx = new JTextField(8); fx.setEditable(false); fy = new JTextField(8); fy.setEditable(false); coords.add(fy); coords.add(fx); content.add(coords); content.add(new JLabel(i18n.getString("window.route.destino"), JLabel.LEFT)); JPanel coords2 = new JPanel(new GridLayout(1, 2)); coords2.setOpaque(false); tx = new JTextField(8); tx.setEditable(false); ty = new JTextField(8); ty.setEditable(false); coords2.add(ty); coords2.add(tx); content.add(coords2); SpringUtilities.makeCompactGrid(content, 2, 2, 6, 6, 6, 6); base.add(content); // Area para mensajes JPanel notificationArea = new JPanel(); notificationArea.setOpaque(false); notification = new JLabel("PLACEHOLDER"); notification.setForeground(Color.WHITE); notificationArea.add(notification); base.add(notificationArea); JPanel buttons = new JPanel(); buttons.setOpaque(false); buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS)); search = new JButton(i18n.getString("window.route.calcular"), LogicConstants.getIcon("ventanacontextual_button_calcularruta")); search.addActionListener(this); buttons.add(search); clear = new JButton(i18n.getString("window.route.limpiar"), LogicConstants.getIcon("button_limpiar")); clear.addActionListener(this); buttons.add(clear); buttons.add(Box.createHorizontalGlue()); progressIcon = new JLabel(iconTransparente); buttons.add(progressIcon); buttons.add(Box.createHorizontalGlue()); JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel")); cancel.addActionListener(this); buttons.add(cancel); base.add(buttons); getContentPane().add(base); pack(); int x; int y; Container myParent; try { myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getContentPane(); java.awt.Point topLeft = myParent.getLocationOnScreen(); Dimension parentSize = myParent.getSize(); Dimension mySize = getSize(); if (parentSize.width > mySize.width) x = ((parentSize.width - mySize.width) / 2) + topLeft.x; else x = topLeft.x; if (parentSize.height > mySize.height) y = ((parentSize.height - mySize.height) / 2) + topLeft.y; else y = topLeft.y; setLocation(x, y); } catch (Throwable e1) { LOG.error("There is no basic window!", e1); } }