List of usage examples for javax.swing JToolBar JToolBar
public JToolBar()
HORIZONTAL
. From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartUIHelper.java
/*********************************************************************************************** * Create the default Toolbar for a Chart. * * @param obsinstrument//w w w .j av a2 s . c o m * @param chart * @param title * @param fontdata * @param colourforeground * @param colourbackground * @param debug * * @return JToolBar */ public static JToolBar createDefaultToolbar(final ObservatoryInstrumentInterface obsinstrument, final ChartUIComponentPlugin chart, final String title, final FontInterface fontdata, final ColourInterface colourforeground, final ColourInterface colourbackground, final boolean debug) { final JToolBar toolbar; if ((obsinstrument != null) && (chart != null)) { final List<Component> listComponentsToAdd; final JLabel labelName; listComponentsToAdd = new ArrayList<Component>(10); //------------------------------------------------------------------------------------- // Initialise the Label labelName = new JLabel(title, RegistryModelUtilities.getAtomIcon(obsinstrument.getHostAtom(), ObservatoryInterface.FILENAME_ICON_CHART_VIEWER), SwingConstants.LEFT) { static final long serialVersionUID = 7580736117336162922L; // Enable Antialiasing in Java 1.5 protected void paintComponent(final Graphics graphics) { final Graphics2D graphics2D = (Graphics2D) graphics; // For antialiasing text graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); super.paintComponent(graphics2D); } }; labelName.setFont( fontdata.getFont().deriveFont(ReportTableHelper.SIZE_HEADER_FONT).deriveFont(Font.BOLD)); labelName.setForeground(colourforeground.getColor()); labelName.setIconTextGap(UIComponentPlugin.TOOLBAR_ICON_TEXT_GAP); listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR_BUTTON)); listComponentsToAdd.add(labelName); listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR)); listComponentsToAdd.add(Box.createHorizontalGlue()); UIComponentHelper.addToolbarPrintButtons(listComponentsToAdd, chart, chart.getChartPanel(), title, fontdata, colourforeground, colourbackground, debug); // Build the Toolbar using the Components, if any toolbar = UIComponentHelper.buildToolbar(listComponentsToAdd); } else { toolbar = new JToolBar(); } toolbar.setFloatable(false); toolbar.setMinimumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE); toolbar.setPreferredSize(UIComponentPlugin.DIM_TOOLBAR_SIZE); toolbar.setMaximumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE); toolbar.setBackground(colourbackground.getColor()); NavigationUtilities.updateComponentTreeUI(toolbar); return (toolbar); }
From source file:com.opendoorlogistics.studio.scripts.list.ScriptsPanel.java
/** * Create the panel.//from w w w . j a va2s .c o m */ public ScriptsPanel(ODLApi api, File directory, ScriptUIManager launchScriptEditor) { this.scriptUIManager = launchScriptEditor; this.api = api; // find a sensible directory if (directory == null) { directory = new File(ScriptConstants.DIRECTORY); if (!directory.exists()) { directory = new File(""); } } this.directory = directory; setLayout(new BorderLayout(0, 0)); // Add directory browser and label at the top in their own panel. // Label is wrapped in a panel because alignment is being ignored and this at least makes it properly centred. // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4275005 boolean lockedDir = scriptUIManager.getAppPermissions().isScriptDirectoryLocked(); if (!lockedDir) { JLabel lblLabel = new JLabel("Scripts directory"); JPanel labelPanel = new JPanel(new BorderLayout()); labelPanel.add(lblLabel, BorderLayout.CENTER); labelPanel.setMaximumSize(lblLabel.getMinimumSize()); dirChooser = new FileBrowserPanel(directory.getAbsolutePath(), new FilenameChangeListener() { @Override public void filenameChanged(String newFilename) { ScriptsPanel.this.directory = new File(newFilename); onDirectoryChanged(ScriptsPanel.this.directory); } }, true, "Select"); JPanel topPanel = LayoutUtils.createVerticalBoxLayout(labelPanel, dirChooser); add(topPanel, BorderLayout.NORTH); } else { dirChooser = null; } // add toolbar at the bottom JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); add(toolBar, BorderLayout.SOUTH); // create all actions and add as buttons and menu items popup = new JPopupMenu(); actions = createActions(launchScriptEditor.getAppPermissions()); for (Action action : actions) { toolBar.add(action); popup.add(action); } // add list in the centre scriptsTree = new ScriptsTree(scriptUIManager, popup); scriptsTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { ScriptsPanel.this.updateAppearance(); } }); add(scriptsTree.getScrollPane(), BorderLayout.CENTER); // // create selection changed listener on the list // listControl.addListSelectionListener(new ListSelectionListener() { // // @Override // public void valueChanged(ListSelectionEvent e) { // updateAppearance(); // } // }); // finally file the list onDirectoryChanged(directory); }
From source file:com.sshtools.common.ui.SshToolsApplicationPanel.java
/** * Initialize the panel/*from ww w.j av a 2 s. c o m*/ * * @param application * * @throws SshToolsApplicationException */ public void init(SshToolsApplication application) throws SshToolsApplicationException { this.application = application; menuBar = new JMenuBar(); // Creat the tool bar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setBorderPainted(false); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // Create the context menu contextMenu = new JPopupMenu(); registerActionMenu(new ActionMenu("Tools", "Tools", 't', 30)); if (PreferencesStore.isStoreAvailable()) { log.debug("Preferences store is available, adding options action"); registerAction(new OptionsAction() { public void actionPerformed(ActionEvent evt) { showOptions(); } }); } }
From source file:net.nosleep.superanalyzer.panels.HomePanel.java
public JPanel createRightButtonBarPanel(final PieRotator rotator) { URL url = this.getClass().getResource("/media/" + "ButtonPlay.png"); final ImageIcon playIcon = new ImageIcon(Toolkit.getDefaultToolkit().getImage(url)); url = this.getClass().getResource("/media/" + "ButtonPause.png"); final ImageIcon pauseIcon = new ImageIcon(Toolkit.getDefaultToolkit().getImage(url)); final JButton button = new JButton(playIcon); button.setBorder(null);// w ww. j a v a 2 s . c o m button.setBorderPainted(false); button.setText(null); button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { if (rotator.isRunning() == false) { rotator.start(); button.setIcon(pauseIcon); } else { rotator.stop(); button.setIcon(playIcon); } } }); JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setBackground(Color.white); toolBar.add(button); JPanel barPanel = new JPanel(new BorderLayout()); barPanel.setBackground(Color.white); barPanel.add(toolBar, BorderLayout.SOUTH); return barPanel; }
From source file:livecanvas.mesheditor.MeshEditor.java
private JToolBar createToolBar() { JToolBar toolbar = new JToolBar(); JButton button;/*from w w w.j ava2s. c om*/ toolbar.add(Utils.createToolBarButton("New mesh", new ImageIcon(clazz.getResource("res/new.png")), ButtonType.ICON_ONLY, NEW, "New", this)); toolbar.add(Utils.createToolBarButton("Open", new ImageIcon(clazz.getResource("res/open.png")), ButtonType.ICON_ONLY, OPEN, "Open a saved mesh", this)); toolbar.add(Utils.createToolBarButton("Save", new ImageIcon(clazz.getResource("res/save.png")), ButtonType.ICON_ONLY, SAVE, "Save mesh", this)); toolbar.addSeparator(); toolbar.add(Utils.createToolBarButton("Cut", new ImageIcon(clazz.getResource("res/cut.png")), ButtonType.ICON_ONLY, CUT, "Cut selection to clipboard", this)); toolbar.add(Utils.createToolBarButton("Copy", new ImageIcon(clazz.getResource("res/copy.png")), ButtonType.ICON_ONLY, COPY, "Copy selection to clipboard", this)); toolbar.add(Utils.createToolBarButton("Paste", new ImageIcon(clazz.getResource("res/paste.png")), ButtonType.ICON_ONLY, PASTE, "Paste content from clipboard", this)); toolbar.addSeparator(); toolbar.add(Utils.createToolBarButton("Undo", new ImageIcon(clazz.getResource("res/undo.png")), ButtonType.ICON_ONLY, UNDO, "Undo last action", this)); toolbar.add(Utils.createToolBarButton("Redo", new ImageIcon(clazz.getResource("res/redo.png")), ButtonType.ICON_ONLY, REDO, "Redo last undone action", this)); toolbar.addSeparator(); JPanel rendererSelectContainer = new JPanel(); rendererSelectContainer.setOpaque(false); rendererSelectContainer.setMaximumSize(new Dimension(150, 40)); rendererSelectContainer.add(rendererSelect = new JComboBox(Style.Styles)); rendererSelect.setSelectedIndex(Style.Styles.length - 1); toolbar.add(rendererSelectContainer); toolbar.add(Utils.createToolBarButton("Render Settings", new ImageIcon(clazz.getResource("res/render_settings.png")), ButtonType.ICON_ONLY, RENDER_SETTINGS, "Render Settings", this)); toolbar.add(Utils.createToolBarButton("Render", new ImageIcon(clazz.getResource("res/render.png")), ButtonType.ICON_ONLY, RENDER, "Render mesh using current style", this)); return toolbar; }
From source file:com.net2plan.gui.utils.topologyPane.TopologyPanel.java
/** * Default constructor./*from w ww . j a v a 2 s.c o m*/ * * @param callback Topology callback listening plugin events * @param defaultDesignDirectory Default location for design {@code .n2p} files (it may be null, then default is equal to {@code net2planFolder/workspace/data/networkTopologies}) * @param defaultDemandDirectory Default location for design {@code .n2p} files (it may be null, then default is equal to {@code net2planFolder/workspace/data/trafficMatrices}) * @param canvasType Canvas type (i.e. JUNG) * @param plugins List of plugins to be included (it may be null) */ public TopologyPanel(final IVisualizationCallback callback, File defaultDesignDirectory, File defaultDemandDirectory, Class<? extends ITopologyCanvas> canvasType, List<ITopologyCanvasPlugin> plugins) { File currentDir = SystemUtils.getCurrentDir(); this.callback = callback; this.defaultDesignDirectory = defaultDesignDirectory == null ? new File( currentDir + SystemUtils.getDirectorySeparator() + "workspace" + SystemUtils.getDirectorySeparator() + "data" + SystemUtils.getDirectorySeparator() + "networkTopologies") : defaultDesignDirectory; this.defaultDemandDirectory = defaultDemandDirectory == null ? new File( currentDir + SystemUtils.getDirectorySeparator() + "workspace" + SystemUtils.getDirectorySeparator() + "data" + SystemUtils.getDirectorySeparator() + "trafficMatrices") : defaultDemandDirectory; this.multilayerControlPanel = new MultiLayerControlPanel(callback); try { canvas = canvasType.getDeclaredConstructor(IVisualizationCallback.class, TopologyPanel.class) .newInstance(callback, this); } catch (Exception e) { throw new RuntimeException(e); } if (plugins != null) for (ITopologyCanvasPlugin plugin : plugins) addPlugin(plugin); setLayout(new BorderLayout()); JToolBar toolbar = new JToolBar(); toolbar.setRollover(true); toolbar.setFloatable(false); toolbar.setOpaque(false); toolbar.setBorderPainted(false); JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(toolbar, BorderLayout.NORTH); add(topPanel, BorderLayout.NORTH); JComponent canvasComponent = canvas.getCanvasComponent(); canvasPanel = new JPanel(new BorderLayout()); canvasComponent.setBorder(LineBorder.createBlackLineBorder()); JToolBar multiLayerToolbar = new JToolBar(JToolBar.VERTICAL); multiLayerToolbar.setRollover(true); multiLayerToolbar.setFloatable(false); multiLayerToolbar.setOpaque(false); canvasPanel.add(canvasComponent, BorderLayout.CENTER); canvasPanel.add(multiLayerToolbar, BorderLayout.WEST); add(canvasPanel, BorderLayout.CENTER); btn_load = new JButton(); btn_load.setToolTipText("Load a network design"); btn_loadDemand = new JButton(); btn_loadDemand.setToolTipText("Load a traffic demand set"); btn_save = new JButton(); btn_save.setToolTipText("Save current state to a file"); btn_zoomIn = new JButton(); btn_zoomIn.setToolTipText("Zoom in"); btn_zoomOut = new JButton(); btn_zoomOut.setToolTipText("Zoom out"); btn_zoomAll = new JButton(); btn_zoomAll.setToolTipText("Zoom all"); btn_takeSnapshot = new JButton(); btn_takeSnapshot.setToolTipText("Take a snapshot of the canvas"); btn_showNodeNames = new JToggleButton(); btn_showNodeNames.setToolTipText("Show/hide node names"); btn_showLinkIds = new JToggleButton(); btn_showLinkIds.setToolTipText( "Show/hide link utilization, measured as the ratio between the total traffic in the link (including that in protection segments) and total link capacity (including that reserved by protection segments)"); btn_showNonConnectedNodes = new JToggleButton(); btn_showNonConnectedNodes.setToolTipText("Show/hide non-connected nodes"); btn_increaseNodeSize = new JButton(); btn_increaseNodeSize.setToolTipText("Increase node size"); btn_decreaseNodeSize = new JButton(); btn_decreaseNodeSize.setToolTipText("Decrease node size"); btn_increaseFontSize = new JButton(); btn_increaseFontSize.setToolTipText("Increase font size"); btn_decreaseFontSize = new JButton(); btn_decreaseFontSize.setToolTipText("Decrease font size"); /* Multilayer buttons */ btn_increaseInterLayerDistance = new JButton(); btn_increaseInterLayerDistance .setToolTipText("Increase the distance between layers (when more than one layer is visible)"); btn_decreaseInterLayerDistance = new JButton(); btn_decreaseInterLayerDistance .setToolTipText("Decrease the distance between layers (when more than one layer is visible)"); btn_showLowerLayerInfo = new JToggleButton(); btn_showLowerLayerInfo .setToolTipText("Shows the links in lower layers that carry traffic of the picked element"); btn_showLowerLayerInfo.setSelected(getVisualizationState().isShowInCanvasLowerLayerPropagation()); btn_showUpperLayerInfo = new JToggleButton(); btn_showUpperLayerInfo.setToolTipText( "Shows the links in upper layers that carry traffic that appears in the picked element"); btn_showUpperLayerInfo.setSelected(getVisualizationState().isShowInCanvasUpperLayerPropagation()); btn_showThisLayerInfo = new JToggleButton(); btn_showThisLayerInfo.setToolTipText( "Shows the links in the same layer as the picked element, that carry traffic that appears in the picked element"); btn_showThisLayerInfo.setSelected(getVisualizationState().isShowInCanvasThisLayerPropagation()); btn_npChangeUndo = new JButton(); btn_npChangeUndo.setToolTipText( "Navigate back to the previous state of the network (last time the network design was changed)"); btn_npChangeRedo = new JButton(); btn_npChangeRedo.setToolTipText( "Navigate forward to the next state of the network (when network design was changed"); btn_osmMap = new JToggleButton(); btn_osmMap.setToolTipText( "Toggle between on/off the OSM support. An internet connection is required in order for this to work."); btn_tableControlWindow = new JButton(); btn_tableControlWindow.setToolTipText("Show the network topology control window."); // MultiLayer control window JPopupMenu multiLayerPopUp = new JPopupMenu(); multiLayerPopUp.add(multilayerControlPanel); JPopUpButton btn_multilayer = new JPopUpButton("", multiLayerPopUp); btn_reset = new JButton("Reset"); btn_reset.setToolTipText("Reset the user interface"); btn_reset.setMnemonic(KeyEvent.VK_R); btn_load.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/loadDesign.png"))); btn_loadDemand.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/loadDemand.png"))); btn_save.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/saveDesign.png"))); btn_showNodeNames .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showNodeName.png"))); btn_showLinkIds .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLinkUtilization.png"))); btn_showNonConnectedNodes.setIcon( new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showNonConnectedNodes.png"))); //btn_whatIfActivated.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showNonConnectedNodes.png"))); btn_zoomIn.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/zoomIn.png"))); btn_zoomOut.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/zoomOut.png"))); btn_zoomAll.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/zoomAll.png"))); btn_takeSnapshot.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/takeSnapshot.png"))); btn_increaseNodeSize .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/increaseNode.png"))); btn_decreaseNodeSize .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/decreaseNode.png"))); btn_increaseFontSize .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/increaseFont.png"))); btn_decreaseFontSize .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/decreaseFont.png"))); btn_increaseInterLayerDistance.setIcon( new ImageIcon(TopologyPanel.class.getResource("/resources/gui/increaseLayerDistance.png"))); btn_decreaseInterLayerDistance.setIcon( new ImageIcon(TopologyPanel.class.getResource("/resources/gui/decreaseLayerDistance.png"))); btn_multilayer .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerControl.png"))); btn_showThisLayerInfo .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerPropagation.png"))); btn_showUpperLayerInfo.setIcon( new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerUpperPropagation.png"))); btn_showLowerLayerInfo.setIcon( new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerLowerPropagation.png"))); btn_tableControlWindow .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showControl.png"))); btn_osmMap.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showOSM.png"))); btn_npChangeUndo.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/undoButton.png"))); btn_npChangeRedo.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/redoButton.png"))); btn_load.addActionListener(this); btn_loadDemand.addActionListener(this); btn_save.addActionListener(this); btn_showNodeNames.addActionListener(this); btn_showLinkIds.addActionListener(this); btn_showNonConnectedNodes.addActionListener(this); btn_zoomIn.addActionListener(this); btn_zoomOut.addActionListener(this); btn_zoomAll.addActionListener(this); btn_takeSnapshot.addActionListener(this); btn_reset.addActionListener(this); btn_increaseInterLayerDistance.addActionListener(this); btn_decreaseInterLayerDistance.addActionListener(this); btn_showLowerLayerInfo.addActionListener(this); btn_showUpperLayerInfo.addActionListener(this); btn_showThisLayerInfo.addActionListener(this); btn_increaseNodeSize.addActionListener(this); btn_decreaseNodeSize.addActionListener(this); btn_increaseFontSize.addActionListener(this); btn_decreaseFontSize.addActionListener(this); btn_npChangeUndo.addActionListener(this); btn_npChangeRedo.addActionListener(this); btn_osmMap.addActionListener(this); btn_tableControlWindow.addActionListener(this); toolbar.add(btn_load); toolbar.add(btn_loadDemand); toolbar.add(btn_save); toolbar.add(new JToolBar.Separator()); toolbar.add(btn_zoomIn); toolbar.add(btn_zoomOut); toolbar.add(btn_zoomAll); toolbar.add(btn_takeSnapshot); toolbar.add(new JToolBar.Separator()); toolbar.add(btn_showNodeNames); toolbar.add(btn_showLinkIds); toolbar.add(btn_showNonConnectedNodes); toolbar.add(new JToolBar.Separator()); toolbar.add(btn_increaseNodeSize); toolbar.add(btn_decreaseNodeSize); toolbar.add(btn_increaseFontSize); toolbar.add(btn_decreaseFontSize); toolbar.add(new JToolBar.Separator()); toolbar.add(Box.createHorizontalGlue()); toolbar.add(btn_osmMap); toolbar.add(btn_tableControlWindow); toolbar.add(btn_reset); multiLayerToolbar.add(new JToolBar.Separator()); multiLayerToolbar.add(btn_multilayer); multiLayerToolbar.add(btn_increaseInterLayerDistance); multiLayerToolbar.add(btn_decreaseInterLayerDistance); multiLayerToolbar.add(btn_showLowerLayerInfo); multiLayerToolbar.add(btn_showUpperLayerInfo); multiLayerToolbar.add(btn_showThisLayerInfo); multiLayerToolbar.add(Box.createVerticalGlue()); multiLayerToolbar.add(btn_npChangeUndo); multiLayerToolbar.add(btn_npChangeRedo); this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { if (e.getComponent().getSize().getHeight() != 0 && e.getComponent().getSize().getWidth() != 0) { canvas.zoomAll(); } } }); List<Component> children = SwingUtils.getAllComponents(this); for (Component component : children) if (component instanceof AbstractButton) component.setFocusable(false); if (ErrorHandling.isDebugEnabled()) { canvas.getCanvasComponent().addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { Point point = e.getPoint(); position.setText("view = " + point + ", NetPlan coord = " + canvas.getCanvasPointFromNetPlanPoint(point)); } }); position = new JLabel(); add(position, BorderLayout.SOUTH); } else { position = null; } new FileDrop(canvasComponent, new LineBorder(Color.BLACK), new FileDrop.Listener() { @Override public void filesDropped(File[] files) { for (File file : files) { try { if (!file.getName().toLowerCase(Locale.getDefault()).endsWith(".n2p")) return; loadDesignFromFile(file); break; } catch (Throwable e) { break; } } } }); btn_showNodeNames.setSelected(getVisualizationState().isCanvasShowNodeNames()); btn_showLinkIds.setSelected(getVisualizationState().isCanvasShowLinkLabels()); btn_showNonConnectedNodes.setSelected(getVisualizationState().isCanvasShowNonConnectedNodes()); final ITopologyCanvasPlugin popupPlugin = new PopupMenuPlugin(callback, this.canvas); addPlugin(new PanGraphPlugin(callback, canvas, MouseEvent.BUTTON1_MASK)); if (callback.getVisualizationState().isNetPlanEditable() && getCanvas() instanceof JUNGCanvas) addPlugin(new AddLinkGraphPlugin(callback, canvas, MouseEvent.BUTTON1_MASK, MouseEvent.BUTTON1_MASK | MouseEvent.SHIFT_MASK)); addPlugin(popupPlugin); if (callback.getVisualizationState().isNetPlanEditable()) addPlugin(new MoveNodePlugin(callback, canvas, MouseEvent.BUTTON1_MASK | MouseEvent.CTRL_MASK)); setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Network topology")); // setAllowLoadTrafficDemand(callback.allowLoadTrafficDemands()); }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Constructor/*from w ww . j a v a 2s. c om*/ * * @param compactLayout * if false, there will be message type selectors in the panel */ public ChatServicePanel(boolean compactLayout) { super(new BorderLayout()); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area if (compactLayout) { messageText = new JTextField(); ((JTextField) messageText).addActionListener(this); sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } // Add buttons ButtonGroup group = new ButtonGroup(); messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group); warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group); alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); msgTypePanel.add(messageTypeBtn); msgTypePanel.add(warningTypeBtn); msgTypePanel.add(alertTypeBtn); } if (compactLayout) { sendBtn = new JButton("Send"); sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } else { sendBtn = new JButton("Send", ICON_MESSAGE); sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height)); sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } sendBtn.setEnabled(false); messageText.setEditable(false); sendBtn.addActionListener(this); }
From source file:edu.ucla.stat.SOCR.chart.SuperPowerChart.java
public void init() { indLabel = new JLabel("X"); depLabel = new JLabel("Y"); super.init(); sliderPanel = new JPanel(); powerSlider = new edu.ucla.stat.SOCR.util.FloatSlider("Power", 1.0, -10.0, 10.0); powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X + 150, 80)); powerSlider.addObserver(this); powerSlider.setToolTipText("Slider for adjusting the value of power."); sliderPanel.add(this.powerSlider); /* toolBarPanel.add(sliderPanel); // ww w.ja v a2s .com toolBarPanel = new JPanel(); JScrollPane toolBarContainer = new JScrollPane(toolBarPanel); toolBarPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));*/ // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); JPanel toolBarContainer = new JPanel(); toolBarContainer.add(toolBar); //toolBarPanel.add(toolBar); JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer, new JScrollPane(sliderPanel)); toolContainer.setContinuousLayout(true); toolContainer.setDividerLocation(0.6); this.getContentPane().add(toolContainer, BorderLayout.NORTH); depMax = 50; // max number of dependent var indMax = 50; // max number of independent var updateStatus(url); resetExample(); validate(); }
From source file:aurelienribon.gdxsetupui.ui.panels.LibrarySelectionPanel.java
private void buildLibraryPanel(final String libraryName) { ActionListener nameChkAL = new ActionListener() { @Override/* w ww .jav a 2 s .c o m*/ public void actionPerformed(ActionEvent e) { if (((CompactCheckBox) e.getSource()).isSelected()) { if (!Ctx.cfgSetup.libraries.contains(libraryName)) Ctx.cfgSetup.libraries.add(libraryName); if (!Ctx.cfgUpdate.libraries.contains(libraryName)) Ctx.cfgUpdate.libraries.add(libraryName); } else { Ctx.cfgSetup.libraries.remove(libraryName); Ctx.cfgUpdate.libraries.remove(libraryName); } Ctx.fireCfgSetupChanged(); Ctx.fireCfgUpdateChanged(); } }; Action infoAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { showInfo(libraryName); } }; Action browseAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { browse(libraryName); } }; Action getStableAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { getStable(libraryName); } }; Action getLatestAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { getLatest(libraryName); } }; LibraryDef def = Ctx.libs.getDef(libraryName); CompactCheckBox nameChk = new CompactCheckBox(def.name + " "); JLabel html5Label = new JLabel(Res.getImage("gfx/ic_html5.png")); JButton infoBtn = new JButton(infoAction); JButton browseBtn = new JButton(browseAction); JButton getStableBtn = new JButton(getStableAction); JButton getLatestBtn = new JButton(getLatestAction); nameChk.addActionListener(nameChkAL); nameChk.setForeground(LIB_NOTFOUND_COLOR); html5Label.setToolTipText("Compatible with HTML backend"); infoBtn.setIcon(Res.getImage("gfx/ic_info.png")); browseBtn.setIcon(Res.getImage("gfx/ic_browse.png")); getStableBtn.setIcon(Res.getImage("gfx/ic_download_stable.png")); getLatestBtn.setIcon(Res.getImage("gfx/ic_download_nightlies.png")); infoBtn.setFocusable(false); browseBtn.setFocusable(false); getStableBtn.setFocusable(false); getLatestBtn.setFocusable(false); JToolBar toolBar = new JToolBar(); toolBar.setOpaque(false); toolBar.setFloatable(false); toolBar.add(Box.createHorizontalGlue()); toolBar.add(infoBtn); toolBar.add(browseBtn); if (def.stableUrl != null) toolBar.add(getStableBtn); else toolBar.add(Box.createHorizontalStrut(libgdxGetStableBtn.getPreferredSize().width)); if (def.latestUrl != null) toolBar.add(getLatestBtn); else toolBar.add(Box.createHorizontalStrut(libgdxGetNightliesBtn.getPreferredSize().width)); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.setOpaque(false); leftPanel.add(nameChk, BorderLayout.CENTER); if (def.gwtModuleName != null) leftPanel.add(html5Label, BorderLayout.EAST); JPanel panel = new JPanel(new BorderLayout()); panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 25)); panel.setOpaque(false); panel.add(leftPanel, BorderLayout.WEST); panel.add(toolBar, BorderLayout.CENTER); librariesPanel.add(panel); Style.apply(librariesPanel, style); libsNamesCmps.put(libraryName, nameChk); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationCalibrationPanel.java
private JToolBar createToolBarDocument() { JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false);//from ww w . j a v a2s . c om toolbar.add(theActionManager.get("last")); toolbar.add(theActionManager.get("close")); toolbar.add(theActionManager.get("next")); toolbar.addSeparator(); toolbar.add(accunit_button = new JButton(theActionManager.get("accunit=ppm"))); accunit_button.setText(null); toolbar.add(theActionManager.get("new")); toolbar.addSeparator(); toolbar.add(theActionManager.get("print")); //toolbar.addSeparator(); //toolbar.add(theActionManager.get("undo")); //toolbar.add(theActionManager.get("redo")); return toolbar; }