List of usage examples for javax.swing Box createHorizontalGlue
public static Component createHorizontalGlue()
From source file:org.apache.jmeter.protocol.http.control.gui.WebServiceSamplerGui.java
private final JPanel createParametersPanel() { JPanel paramsPanel = new JPanel(); paramsPanel.setLayout(new BoxLayout(paramsPanel, BoxLayout.X_AXIS)); paramsPanel.add(path);//from www . j a v a 2 s. c om paramsPanel.add(Box.createHorizontalGlue()); paramsPanel.add(soapAction); paramsPanel.add(Box.createHorizontalGlue()); paramsPanel.add(maintainSession); return paramsPanel; }
From source file:es.emergya.ui.gis.CustomMapView.java
public CustomMapView() { super();//from w w w .j a v a 2 s. c o m menu = new MainMenu(); contentPane.add(panel, BorderLayout.CENTER); // iniciar los controles mostrar/ocultar capas layerControls = new LinkedList<JToggleButton>(); JToggleButton botonMostrarOcultarBotones = new JToggleButton(getI18n().getString("map.layers.hideButtons"), LogicConstants.getIcon("capas_button_mostrar"), false); botonMostrarOcultarBotones.setSelected(true); botonMostrarOcultarBotones.setActionCommand("#hide"); // b.setVerticalTextPosition(SwingConstants.BOTTOM); // b.setHorizontalTextPosition(SwingConstants.CENTER); botonMostrarOcultarBotones.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JToggleButton b = (JToggleButton) e.getSource(); if (e.getActionCommand().equals("#hide")) { layerControlPanel.removeAll(); layerControlPanel.add(Box.createHorizontalStrut(10)); layerControlPanel.add(b); b.setActionCommand("#show"); b.setText(getI18n().getString("map.layers.showButtons")); } else { layerControlPanel.removeAll(); layerControlPanel.add(Box.createHorizontalStrut(10)); for (JToggleButton bt : layerControls) { layerControlPanel.add(bt); layerControlPanel.add(Box.createHorizontalGlue()); } b.setActionCommand("#hide"); b.setText(getI18n().getString("map.layers.hideButtons")); } layerControlPanel.updateUI(); } }); layerControls.add(botonMostrarOcultarBotones); final JToggleButton botonTodoasLasCapas = new JToggleButton(getI18n().getString("map.layers.allLayers"), LogicConstants.getIcon("capas_button_mostrar"), false); layerDialog = new LayerSelectionDialog(this); layerDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { botonTodoasLasCapas.setSelected(false); } }); botonTodoasLasCapas.setSelected(false); botonTodoasLasCapas.setActionCommand("#all"); // all.setVerticalTextPosition(SwingConstants.BOTTOM); // all.setHorizontalTextPosition(SwingConstants.CENTER); botonTodoasLasCapas.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { layerDialog.setLocationRelativeTo((Component) e.getSource()); layerDialog.setVisible(!layerDialog.isShowing()); } }); layerControls.add(botonTodoasLasCapas); layerControlPanel = new JPanel(); layerControlPanel.setLayout(new BoxLayout(layerControlPanel, BoxLayout.X_AXIS)); Main.main.menu = this.menu; toolbar = new ToolbarPreferences(); toolbar.refreshToolbarControl(); // toolbar.control.updateUI(); // contentPane.add(toolbar.control, BorderLayout.NORTH); contentPane.updateUI(); panel.updateUI(); }
From source file:com.eviware.soapui.support.components.SimpleForm.java
public void appendHeadingAndHelpButton(String text, String helpUrl) { JLabel label = new JLabel(text); Font font = label.getFont();//w w w . j a va 2 s . c o m Font fontBold = new Font(font.getName(), Font.BOLD, font.getSize()); label.setFont(fontBold); JPanel innerPanel = new JPanel(); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS)); innerPanel.add(label); innerPanel.add(Box.createHorizontalGlue()); innerPanel.add(UISupport.createFormButton(new ShowOnlineHelpAction(helpUrl))); append(null, null, innerPanel, null, DEFAULT_LABEL_COLUMN, getColumnSpanToTheEnd(DEFAULT_LABEL_COLUMN)); }
From source file:com.diversityarrays.kdxplore.vistool.AskForTraitInstances.java
AskForTraitInstances(Window owner, String title, boolean xAndYaxes, String okLabel, TraitNameStyle tns, Map<TraitInstance, SimpleStatistics<?>> map, int[] minMax, Closure<List<TraitInstance>> onInstancesChosen) { super(owner, title, ModalityType.MODELESS); this.traitNameStyle = tns; this.minInstances = minMax[0]; this.maxInstances = minMax[1]; this.onInstancesChosen = onInstancesChosen; if (xAndYaxes) { tableModel = new TraitInstanceAxisChoiceTableModel(); } else {// ww w. j a va2s .c o m tableModel = new TraitInstanceChoiceTableModel(); } table = new JTable(tableModel); okAction.putValue(Action.NAME, okLabel); traitInstances = new ArrayList<TraitInstance>(map.keySet()); Collections.sort(traitInstances, TraitHelper.COMPARATOR); table.setAutoCreateRowSorter(true); Box box = Box.createHorizontalBox(); box.add(message); box.add(Box.createHorizontalGlue()); box.add(new JButton(okAction)); box.add(new JButton(cancelAction)); getContentPane().add(new JScrollPane(table), BorderLayout.CENTER); getContentPane().add(box, BorderLayout.SOUTH); pack(); tableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { updateOkButton(); } }); updateOkButton(); }
From source file:com.diversityarrays.kdxplore.trialmgr.TrialManagerApp.java
public TrialManagerApp(KdxPluginInfo pluginInfo) throws IOException { super(new BorderLayout()); this.messagesPanel = pluginInfo.getMessagePrinter(); this.backgroundRunner = pluginInfo.getBackgroundRunner(); this.userDataFolder = pluginInfo.getUserDataFolder(); this.clientProvider = pluginInfo.getClientProvider(); this.offlineData = pluginInfo.getSingletonSharedResource(OfflineData.class); KDSmartApplication.getInstance().setMessagePrinter(pluginInfo.getMessagePrintStream()); this.driverType = DriverType.getDriverTypeFromSystemProperties(DriverType.H2); offlineData.addOfflineDataChangeListener(offlineDataChangeListener); linkedIcon = KDClientUtils.getIcon(ImageId.CONNECTED_24); unlinkedIcon = KDClientUtils.getIcon(ImageId.DISCONNECTED_24); barcodeIcon = KDClientUtils.getIcon(ImageId.BARCODE_PAGE); updateDatabaseUrlLabel();// w w w .j av a2s . co m this.clientProvider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { handleClientChanged(); } }); explorerProperties = ExplorerProperties.getInstance(); PreferenceCollection pc = TrialManagerPreferences.getInstance().getPreferenceCollection(this, Msg.APPNAME_TRIAL_MANAGER()); KdxplorePreferences.getInstance().addPreferenceCollection(pc); TraitValue.DISPLAY_DATE_DIFF_AS_NDAYS = explorerProperties.getDisplayElapsedDaysAsCount(); ExplorerServices explorerServices = new ExplorerServices(pluginInfo, offlineData // , clientProvider ); trialExplorerPanel = new TrialExplorerPanel(this, // KdxApp pluginInfo, explorerServices.getKdxDeviceService(), this, // as TrialExplorerManager offlineData, driverType, barcodeIcon, clientUrlChanger, trialsLoadedConsumer, traitRemovalHandler); tabbedPane.addTab(TAB_TRIALS, KDClientUtils.getIcon(ImageId.KDS_TRIALS), trialExplorerPanel); Transformer<Trial, Boolean> checkIfEditorIsActive = new Transformer<Trial, Boolean>() { @Override public Boolean transform(Trial trial) { return trialExplorerPanel.isEditorActiveForTrial(trial); } }; traitExplorerPanel = new TraitExplorerPanel(messagesPanel, offlineData, clientProvider, // uploadHandler, backgroundRunner, barcodeIcon, checkIfEditorIsActive); tabbedPane.addTab(TAB_TRAITS, KDClientUtils.getIcon(ImageId.KDS_TRAITS), traitExplorerPanel); tagExplorerPanel = new TagExplorerPanel(offlineData); tabbedPane.addTab(TAB_TAGS, KDClientUtils.getIcon(ImageId.BLACK_TAG), tagExplorerPanel); // Now tie together those panels that need to talk to each other trialExplorerPanel.setTraitExplorer(traitExplorerPanel); Box box = Box.createHorizontalBox(); explorerServices.addActions(box); box.add(Box.createHorizontalGlue()); box.add(databaseUrlLabel); box.add(Box.createHorizontalGlue()); Action action = offlineData.getOfflineDataAction(); if (action != null) { JButton button = new JButton(pluginInfo.getKdxploreIcon()); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (RunMode.getRunMode().isDeveloper()) { if (0 != (ActionEvent.SHIFT_MASK & e.getModifiers())) { openJdbcExplorer(); return; } } action.actionPerformed(e); } }); box.add(button); } add(box, BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); }
From source file:com.net2plan.gui.utils.onlineSimulationPane.OnlineSimulationPane.java
private JPanel configureSimulationControlPanel() { pan_simulationController = new JPanel(new MigLayout("fill, insets 0 0 0 0")); pan_simulationController/*from www. j ava 2s. com*/ .setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Simulation controller")); simInfo = new JTextArea(); simInfo.setFont(new JLabel().getFont()); DefaultCaret caret = (DefaultCaret) simInfo.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); toolbar = new JToolBar(); btn_run = new JButton("Run"); btn_run.addActionListener(this); btn_run.setToolTipText("Execute the simulation [CTRL + U]"); btn_step = new JButton("Step"); btn_step.addActionListener(this); btn_step.setToolTipText("Execute the next scheduled event and pause"); btn_pause = new JButton("Pause/Continue"); btn_pause.addActionListener(this); btn_pause.setToolTipText("Pause the simulation (if active) or continue (if paused)"); btn_stop = new JButton("Stop"); btn_stop.addActionListener(this); btn_stop.setToolTipText("Stop the simulation (it cannot be resumed later)"); btn_reset = new JButton("Reset"); btn_reset.addActionListener(this); btn_reset.setToolTipText( "After stopping the simulation, resets the design to the initial simulation design"); chk_refresh = new JCheckBox("Refresh"); chk_refresh.setSelected(true); btn_viewEventList = new JButton("View FEL"); btn_viewEventList.setToolTipText("View future event list (FEL)"); btn_viewEventList.addActionListener(this); toolbar.setFloatable(false); toolbar.setRollover(true); toolbar.add(btn_run); toolbar.add(btn_step); toolbar.add(btn_pause); toolbar.add(btn_stop); toolbar.add(btn_reset); toolbar.addSeparator(); toolbar.add(chk_refresh); toolbar.add(Box.createHorizontalGlue()); toolbar.add(btn_viewEventList); pan_simulationController.add(toolbar, "dock north"); pan_simulationController.add(new JScrollPane(simInfo), "grow"); return pan_simulationController; }
From source file:org.tellervo.desktop.io.ImportDialog.java
/** * Set up the button bar/*from w w w . j a v a 2s.c om*/ */ private void setupButtonBar() { bottombar = new JPanel(); bottombar.setLayout(new BoxLayout(bottombar, BoxLayout.X_AXIS)); editEntity = new JToggleButton(); editEntity.setIcon(Builder.getIcon("lock.png", Builder.ICONS, 22)); editEntity.setSelectedIcon(Builder.getIcon("unlock.png", Builder.ICONS, 22)); editEntity.setBorderPainted(false); editEntity.setContentAreaFilled(false); editEntity.setFocusable(false); editEntity.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!editEntity.isSelected() && hasChanged) { if (!warnLosingChanges()) { editEntity.setSelected(true); return; } else { editEntity.setSelected(false); hasChanged = false; } } //enableEditing(editEntity.isSelected()); } }); bottombar.add(editEntity); editEntityText = new JLabel(I18n.getText("general.initializing").toLowerCase()); editEntityText.setLabelFor(editEntity); bottombar.add(editEntityText); editEntitySave = new JButton(I18n.getText("general.saveChanges")); editEntityCancel = new JButton(I18n.getText("general.cancel")); // don't let an errant enter key fire these buttons! editEntitySave.setDefaultCapable(false); editEntityCancel.setDefaultCapable(false); editEntitySave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //doSave(); } }); editEntityCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { hasChanged = false; editEntity.setSelected(false); //enableEditing(false); } }); bottombar.add(Box.createHorizontalGlue()); bottombar.add(editEntitySave); bottombar.add(Box.createHorizontalStrut(6)); bottombar.add(editEntityCancel); bottombar.add(Box.createHorizontalStrut(6)); }
From source file:medsavant.uhn.cancer.UserCommentApp.java
private void updateStatusPanel(UserComment oldComment) { //Write the from-to status to the last comment's status panel. if (oldComment != null && oldComment.getOriginalComment() != null) {//status change comment. JPanel statusIconPanel = new StatusIconPanel(ICON_WIDTH, ICON_HEIGHT, false, oldComment.getOriginalComment().isApproved(), oldComment.getOriginalComment().isIncluded(), oldComment.getOriginalComment().isDeleted()); oldStatusPanel.add(new JLabel(" to ")); oldStatusPanel.add(statusIconPanel); oldStatusPanel.add(Box.createHorizontalGlue()); oldStatusPanel = null;//from w w w . java2 s .co m } }
From source file:com.eviware.soapui.impl.wsdl.panels.request.AbstractWsdlRequestDesktopPanel.java
protected JComponent buildToolbar() { endpointCombo = new JComboBox(endpointsModel); endpointCombo.setToolTipText(endpointsModel.getSelectedItem().toString()); endpointCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { Object item = endpointCombo.getSelectedItem(); if (item == null) { endpointCombo.setToolTipText("- no endpoint set for request -"); } else { String selectedItem = item.toString(); endpointCombo.setToolTipText(selectedItem); }/* w w w . j a v a 2s . co m*/ submitButton.setEnabled(submit == null && request.getEndpoint() != null && request.getEndpoint().trim().length() > 0); } }); JToolBar toolbar = UISupport.createToolbar(); toolbar.add(submitButton); insertButtons(toolbar); toolbar.add(recreateButton); toolbar.add(createEmptyButton); toolbar.add(cloneButton); toolbar.add(cancelButton); toolbar.addSeparator(); toolbar.add(endpointCombo); toolbar.add(Box.createHorizontalGlue()); toolbar.add(tabsButton); toolbar.add(splitButton); toolbar.add(UISupport.createToolbarButton(new ShowOnlineHelpAction(getHelpUrl()))); return toolbar; }
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java
protected static JPanel packHorizontallyLeftAligned(Component[] components, int leftOffset) { JPanel packed = new JPanel(); packed.setOpaque(false);/*from w w w . j ava 2s . c o m*/ packed.setLayout(new BoxLayout(packed, BoxLayout.X_AXIS)); if (leftOffset > 0) { packed.add(Box.createHorizontalStrut(leftOffset)); } int minW = 0, minH = 0; for (Component comp : components) { packed.add(comp); Dimension dim = comp.getMinimumSize(); minW += dim.getWidth(); minH = Math.max(minH, (int) dim.getHeight()); } packed.add(Box.createHorizontalGlue()); packed.setMinimumSize(new Dimension(minW, minH)); packed.setMaximumSize(new Dimension(4000, minH)); packed.setPreferredSize(new Dimension(4000, minH)); return packed; }