Java Code Examples for javax.swing.JToolBar#setFloatable()
The following examples show how to use
javax.swing.JToolBar#setFloatable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestExecutionUI.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 6 votes |
private JPanel getCompInPanel(String labelText, JComponent comp) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setBorder(BorderFactory.createEtchedBorder()); JLabel label = new JLabel(labelText); label.setFont(new Font("Default", Font.BOLD, 12)); toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767))); toolBar.add(label); toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 25)); panel.add(toolBar, BorderLayout.NORTH); panel.add(comp, BorderLayout.CENTER); return panel; }
Example 2
Source File: InfoPanel.java From netbeans with Apache License 2.0 | 6 votes |
private JToolBar createFilterToolBar() { final FiltersDescriptor filtersDesc = FiltersDescriptor.getInstance(); // configure toolbar final JToolBar toolbar = new NoBorderToolBar(); toolbar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); toolbar.setFloatable(false); //toolbar.setRollover(true); toolbar.setBorderPainted(false); toolbar.setOpaque(false); if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N toolbar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N } createFilterToolBarUI(toolbar, filtersDesc); filtersDesc.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createFilterToolBarUI(toolbar, filtersDesc); } }); } }); return toolbar; }
Example 3
Source File: ConsoleWindow.java From triplea with GNU General Public License v3.0 | 6 votes |
private JToolBar createButtonsToolBar(final ConsoleModel model) { final JToolBar buttonsToolBar = new JToolBar(SwingConstants.HORIZONTAL); buttonsToolBar.setFloatable(false); buttonsToolBar.setLayout(new FlowLayout()); buttonsToolBar.add( SwingAction.of("Enumerate Threads", () -> ConsoleModel.enumerateThreadsAction(this))); buttonsToolBar.add(SwingAction.of("Memory", () -> ConsoleModel.memoryAction(this))); buttonsToolBar.add(SwingAction.of("Properties", () -> ConsoleModel.propertiesAction(this))); buttonsToolBar.add( SwingAction.of("Copy to clipboard", () -> model.copyToClipboardAction(this))); buttonsToolBar.add(SwingAction.of("Clear", () -> ConsoleModel.clearAction(this))); buttonsToolBar.add( JComboBoxBuilder.builder(String.class) .selectedItem(ConsoleModel.getCurrentLogLevel()) .items(ConsoleModel.getLogLevelOptions()) .itemSelectedAction(ConsoleModel::setLogLevel) .toolTipText("Increase or decrease log messages printed to console") .build()); return buttonsToolBar; }
Example 4
Source File: ToolBar.java From opt4j with MIT License | 6 votes |
/** * Initialization. This method has to be called once after construction. */ public void init() { toolBar.setFloatable(false); Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, toolBar.getBackground().darker()); toolBar.setBorder(border); List<ToolBarService> list = new ArrayList<>(); list.addAll(toolBarServices); Collections.sort(list, new ToolBarOrderComparator<>()); for (ToolBarService toolBarService : list) { JToolBar component = toolBarService.getToolBar(); component.setFloatable(false); toolBar.add(component); } }
Example 5
Source File: RunningMonitor.java From DeconvolutionLab2 with GNU General Public License v3.0 | 5 votes |
public RunningMonitor(int width, int height) { ArrayList<CustomizedColumn> columns = new ArrayList<CustomizedColumn>(); columns.add(new CustomizedColumn("Time", String.class, 100, false)); columns.add(new CustomizedColumn("Memory", String.class, 100, false)); columns.add(new CustomizedColumn("Iteration", String.class, 60, false)); columns.add(new CustomizedColumn("Message", String.class, Math.max(60, width - 4*100), false)); table = new CustomizedTable(columns, true); table.getColumnModel().getColumn(0).setMinWidth(40); table.getColumnModel().getColumn(0).setMaxWidth(80); table.getColumnModel().getColumn(1).setMinWidth(40); table.getColumnModel().getColumn(1).setMaxWidth(80); table.getColumnModel().getColumn(2).setMinWidth(40); table.getColumnModel().getColumn(2).setMaxWidth(80); JScrollPane scroll = new JScrollPane(table); scroll.setPreferredSize(new Dimension(width, height)); JToolBar main = new JToolBar(); main.setFloatable(true); main.setLayout(new BorderLayout()); main.add(scroll, BorderLayout.CENTER); panel = new JPanel(new BorderLayout()); panel.add(main); panel.setBorder(BorderFactory.createEtchedBorder()); }
Example 6
Source File: RConsoleView.java From visualvm with GNU General Public License v2.0 | 5 votes |
EditorView(REditorComponent editor) { super(new BorderLayout()); editor.clearScrollBorders(); add(editor, BorderLayout.CENTER); // add(new ScrollableContainer(editorContainer), BorderLayout.CENTER); JToolBar controls = new JToolBar(JToolBar.VERTICAL); controls.setFloatable(false); controls.setBorderPainted(false); controls.add(runAction); controls.add(cancelAction); controls.addSeparator(); controls.add(loadAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N controls.add(saveAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N controls.add(editAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N JPanel controlsContainer = new JPanel(new BorderLayout()); controlsContainer.setOpaque(false); controlsContainer.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("Separator.foreground")), // NOI18N BorderFactory.createEmptyBorder(1, 1, 1, 1))); controlsContainer.add(controls, BorderLayout.CENTER); add(controlsContainer, BorderLayout.WEST); // size to always show Run and Stop buttons int h = controls.getComponent(0).getPreferredSize().height; h += controls.getComponent(1).getPreferredSize().height + 2; setMinimumSize(new Dimension(0, h)); }
Example 7
Source File: ResponseBrowserView.java From zap-extensions with Apache License 2.0 | 5 votes |
private JToolBar createToolbar() { JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setMinimumSize(new Dimension(50, 50)); JButton button = createAdjustHeightButton(); toolBar.add(button); return toolBar; }
Example 8
Source File: ProjectListWindow.java From tmc-intellij with MIT License | 5 votes |
/** * Method generated by IntelliJ IDEA GUI Designer. * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void setupUi() { basePanel = new JPanel(); basePanel.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1)); tabbedPaneBase = new JTabbedPane(); basePanel.add(tabbedPaneBase, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null, 0, false)); toolbar = new JToolBar(); toolbar.setBorderPainted(false); toolbar.setFloatable(false); toolbar.setForeground(new Color(-16777216)); basePanel.add(toolbar, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(-1, 20), null, 0, false)); final Spacer spacer1 = new Spacer(); basePanel.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); }
Example 9
Source File: ModelPropertiesDialog.java From ramus with GNU General Public License v3.0 | 5 votes |
private Component createToolBar() { JToolBar bar = new JToolBar(); bar.setFloatable(false); for (Action action : getActions()) if (action == null) bar.addSeparator(); else bar.add(action).setFocusable(false); return bar; }
Example 10
Source File: FiltersManager.java From netbeans with Apache License 2.0 | 5 votes |
/** Called only from AWT */ private void initPanel () { setBorder(new EmptyBorder(1, 2, 3, 5)); // configure toolbar JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL); toolbar.setFloatable(false); toolbar.setRollover(true); toolbar.setBorderPainted(false); // create toggle buttons int filterCount = filtersDesc.getFilterCount(); toggles = new ArrayList<JToggleButton>(filterCount); JToggleButton toggleButton = null; Map<String,Boolean> fStates = new HashMap<String, Boolean>(filterCount * 2); for (int i = 0; i < filterCount; i++) { toggleButton = createToggle(fStates, i); toggles.add(toggleButton); } // add toggle buttons JToggleButton curToggle; Dimension space = new Dimension(3, 0); for (int i = 0; i < toggles.size(); i++) { curToggle = toggles.get(i); curToggle.addActionListener(this); toolbar.add(curToggle); if (i != toggles.size() - 1) { toolbar.addSeparator(space); } } add(toolbar); // initialize member states map synchronized (STATES_LOCK) { filterStates = fStates; } }
Example 11
Source File: CSVColumnPanel.java From javamoney-examples with Apache License 2.0 | 5 votes |
private Panel createButtonPanel() { ActionHandler handler = new ActionHandler(); JToolBar toolBar = new JToolBar(); Panel panel = new Panel(); Dimension separator = new Dimension(15, 10); // Build tool bar. toolBar.setBorderPainted(false); toolBar.setFloatable(false); toolBar.setRollover(true); toolBar.add(createButton(ARROW_UP.getIcon(), ACTION_UP, handler, getProperty("up_tip"))); toolBar.addSeparator(separator); toolBar.add(createButton(ARROW_DOWN.getIcon(), ACTION_DOWN, handler, getProperty("down_tip"))); // Build panel. panel.add(toolBar, 0, 0, 1, 1, 100, 100); return panel; }
Example 12
Source File: StatisticsPanel.java From netbeans with Apache License 2.0 | 5 votes |
/** */ private JComponent createToolbar() { createShowButtons(); createNextPrevFailureButtons(); createRerunButtons(); createOptionButtons(); String testingFramework = Manager.getInstance().getTestingFramework(); JToolBar toolbar = new ToolbarWithOverflow(SwingConstants.VERTICAL); toolbar.add(rerunButton); toolbar.add(rerunFailedButton); toolbar.add(new JToolBar.Separator()); toolbar.add(btnShowPassed); if(testingFramework.equals(Manager.TESTNG_TF)) { toolbar.add(btnShowPassedWithErrors); } toolbar.add(btnShowFailed); toolbar.add(btnShowError); toolbar.add(btnShowAborted); // if(testingFramework.equals(Manager.TESTNG_TF) || testingFramework.equals(Manager.JUNIT_TF)) { // toolbar.add(btnShowIgnored); // } toolbar.add(btnShowSkipped); toolbar.add(new JToolBar.Separator()); toolbar.add(previousFailure); toolbar.add(nextFailure); toolbar.add(new JToolBar.Separator()); toolbar.add(btnAlwaysOpenTRW); toolbar.add(btnAlwaysOpenNewTab); toolbar.setFocusable(false); toolbar.setRollover(true); toolbar.setFloatable(false); return toolbar; }
Example 13
Source File: BatchModule.java From DeconvolutionLab2 with GNU General Public License v3.0 | 5 votes |
@Override public JPanel buildExpandedPanel() { bnRun = new JButton("Run Jobs"); bnLaunch = new JButton("Launch Jobs"); ArrayList<CustomizedColumn> columns = new ArrayList<CustomizedColumn>(); columns.add(new CustomizedColumn("Job", String.class, 120, false)); columns.add(new CustomizedColumn("Command", String.class, Constants.widthGUI, false)); columns.add(new CustomizedColumn("", String.class, 30, "\u232B", "Delete this job")); table = new CustomizedTable(columns, true); table.getColumnModel().getColumn(2).setMaxWidth(30); table.getColumnModel().getColumn(2).setMinWidth(30); table.addMouseListener(this); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); JToolBar pn = new JToolBar("Controls Batch"); pn.setBorder(BorderFactory.createEmptyBorder()); pn.setLayout(new GridLayout(1, 2)); pn.setFloatable(false); pn.add(bnRun); pn.add(bnLaunch); JPanel panel = new JPanel(new BorderLayout()); panel.add(table.getPane(100, 100), BorderLayout.CENTER); panel.add(pn, BorderLayout.SOUTH); getActionButton().addActionListener(this); bnRun.addActionListener(this); bnLaunch.addActionListener(this); return panel; }
Example 14
Source File: PipeApplicationBuilder.java From PIPE with MIT License | 5 votes |
/** * * @param pipeComponents * @return tool bar involved in animation and all its actions */ private JToolBar getAnimationToolBar(PIPEComponents pipeComponents) { JToolBar animationToolBar = new JToolBar(); animationToolBar.setFloatable(false); for (GuiAction action : pipeComponents.animateActionManager.getAnimateActions()) { addButton(animationToolBar, action); } animationToolBar.setVisible(false); return animationToolBar; }
Example 15
Source File: GUIFrame.java From jaamsim with Apache License 2.0 | 4 votes |
/** * Sets up the Control Panel's main tool bar. */ public void initializeMainToolBars() { // Insets used in setting the tool bar components Insets noMargin = new Insets( 0, 0, 0, 0 ); Insets smallMargin = new Insets( 1, 1, 1, 1 ); // Initialize the main tool bar JToolBar mainToolBar = new JToolBar(); mainToolBar.setMargin( smallMargin ); mainToolBar.setFloatable(false); mainToolBar.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) ); // Add the main tool bar to the display getContentPane().add( mainToolBar, BorderLayout.SOUTH ); // Run/pause button addRunButton(mainToolBar, noMargin); Dimension separatorDim = new Dimension(11, controlStartResume.getPreferredSize().height); Dimension gapDim = new Dimension(5, separatorDim.height); // Reset button mainToolBar.add(Box.createRigidArea(gapDim)); addResetButton(mainToolBar, noMargin); // Real time button mainToolBar.addSeparator(separatorDim); addRealTimeButton(mainToolBar, smallMargin); // Speed multiplier spinner mainToolBar.add(Box.createRigidArea(gapDim)); addSpeedMultiplier(mainToolBar, noMargin); // Pause time field mainToolBar.addSeparator(separatorDim); mainToolBar.add(new JLabel("Pause Time:")); mainToolBar.add(Box.createRigidArea(gapDim)); addPauseTime(mainToolBar, noMargin); // Simulation time display mainToolBar.addSeparator(separatorDim); addSimulationTime(mainToolBar, noMargin); // Run progress bar mainToolBar.add(Box.createRigidArea(gapDim)); addRunProgress(mainToolBar, noMargin); // Remaining time display mainToolBar.add(Box.createRigidArea(gapDim)); addRemainingTime(mainToolBar, noMargin); // Achieved speed multiplier mainToolBar.addSeparator(separatorDim); mainToolBar.add(new JLabel("Speed:")); addAchievedSpeedMultiplier(mainToolBar, noMargin); // Cursor position mainToolBar.addSeparator(separatorDim); mainToolBar.add(new JLabel("Position:")); addCursorPosition(mainToolBar, noMargin); }
Example 16
Source File: MainPanel.java From ChromeForensics with Apache License 2.0 | 4 votes |
private void initToolBar() { toolBar = new JToolBar(); toolBar.setOrientation(JToolBar.HORIZONTAL); toolBar.setFloatable(false); toolBar.setPreferredSize(new Dimension(getWidth(), 40)); manuallyLoadData = new JButton(); manuallyLoadData.setIcon(Utils.createImageIcon("images/loaddata.png", "Load Data")); manuallyLoadData.setToolTipText("Manually locate the chrome data files folder."); toolBar.add(manuallyLoadData); autoLoadData = new JButton(); autoLoadData.setIcon(Utils.createImageIcon("images/autosearch.png", "Auto Search and Load Data")); autoLoadData.setToolTipText("Automatically search and load chrome files."); toolBar.add(autoLoadData); toolBar.add(new JToolBar.Separator()); exportTSV = new JButton("Export to"); exportTSV.setIcon(Utils.createImageIcon("images/csv.png", "Export results to CSV")); exportTSV.setToolTipText("Export Results to CSV"); exportTSV.setHorizontalTextPosition(SwingConstants.LEFT); exportTSV.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { ExportDialog export = new ExportDialog(ExportType.TSV); export.setVisible(true); } }); toolBar.add(exportTSV); exportHTML = new JButton("Export to"); exportHTML.setIcon(Utils.createImageIcon("images/html.png", "Export results to HTML")); exportHTML.setToolTipText("Export results to HTML."); exportHTML.setHorizontalTextPosition(SwingConstants.LEFT); toolBar.add(exportHTML); toolBar.add(new JToolBar.Separator()); helpButton = new JButton(); helpButton.setIcon(Utils.createImageIcon("images/help.png", "Need Help? Click Me!")); helpButton.setToolTipText("Need Help? Click Me!"); toolBar.add(helpButton); aboutButton = new JButton(); aboutButton.setIcon(Utils.createImageIcon("images/about.png", "About this tool!")); aboutButton.setToolTipText("About this tool!"); toolBar.add(aboutButton); toolBar.add(new JToolBar.Separator()); exitButton = new JButton(); exitButton.setIcon(Utils.createImageIcon("images/exit.png", "Exit Application.")); exitButton.setToolTipText("Exit Application"); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { ChromeForensicsGui.getInstance().dispose(); } }); toolBar.add(exitButton); }
Example 17
Source File: LobbyGamePanel.java From triplea with GNU General Public License v3.0 | 4 votes |
LobbyGamePanel( final JFrame parent, final LobbyClient lobbyClient, final URI lobbyUri, final LobbyGameTableModel lobbyGameTableModel) { this.parent = parent; this.lobbyClient = lobbyClient; this.gameTableModel = lobbyGameTableModel; this.lobbyUri = lobbyUri; final JButton hostGame = new JButton("Host Game"); joinGame = new JButton("Join Game"); gameTable = new LobbyGameTable(gameTableModel); // only allow one row to be selected gameTable.setColumnSelectionAllowed(false); gameTable.setCellSelectionEnabled(false); gameTable.setRowSelectionAllowed(true); gameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // these should add up to 700 at most gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Players)) .setPreferredWidth(42); gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Round)) .setPreferredWidth(40); gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.P)) .setPreferredWidth(12); gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.GV)) .setPreferredWidth(32); if (lobbyClient.isModerator()) { gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Started)) .setPreferredWidth(55); } gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Status)) .setPreferredWidth(112); gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Name)) .setPreferredWidth(156); gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Comments)) .setPreferredWidth(160); gameTable .getColumnModel() .getColumn(gameTableModel.getColumnIndex(LobbyGameTableModel.Column.Host)) .setPreferredWidth(67); final JScrollPane scroll = new JScrollPane(gameTable); setLayout(new BorderLayout()); add(scroll, BorderLayout.CENTER); final JToolBar toolBar = new JToolBar(); toolBar.add(hostGame); toolBar.add(joinGame); toolBar.setFloatable(false); add(toolBar, BorderLayout.SOUTH); hostGame.addActionListener(e -> hostGame(lobbyUri)); joinGame.addActionListener(e -> joinGame()); gameTable .getSelectionModel() .addListSelectionListener( e -> { final boolean selected = gameTable.getSelectedRow() >= 0; joinGame.setEnabled(selected); }); gameTable.addMouseListener( new MouseListenerBuilder() .mouseClicked(this::mouseClicked) .mousePressed(this::mousePressed) .mouseReleased(this::mouseOnGamesList) .build()); }
Example 18
Source File: CheckWikiWindow.java From wpcleaner with Apache License 2.0 | 4 votes |
/** * @return Page list components */ private Component createPageListComponents() { JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), GT._T("Pages"))); modelPages = new DefaultListModel<CheckErrorPage>(); listPages = new JList<CheckErrorPage>(modelPages); // Initialize constraints GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridheight = 1; constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy = 0; constraints.insets = new Insets(0, 0, 0, 0); constraints.ipadx = 0; constraints.ipady = 0; constraints.weightx = 1; constraints.weighty = 0; // Load pages JToolBar toolbarButtons = new JToolBar(SwingConstants.HORIZONTAL); toolbarButtons.setFloatable(false); JButton buttonLoad = Utilities.createJButton(GT._T("&Load pages"), null); buttonLoad.addActionListener(EventHandler.create( ActionListener.class, this, "actionLoadPages")); toolbarButtons.add(buttonLoad); ActionFullAnalysis.addButton( getParentComponent(), toolbarButtons, getWikipedia(), listPages, null, true, true); JButton buttonAutomaticFixing = Utilities.createJButton( "gnome-view-sort-descending.png", EnumImageSize.NORMAL, GT._T("Automatic fixing"), false, null); buttonAutomaticFixing.addActionListener(EventHandler.create( ActionListener.class, this, "actionRunAutomaticFixing")); toolbarButtons.add(buttonAutomaticFixing); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.weightx = 0; constraints.weighty = 0; panel.add(toolbarButtons, constraints); constraints.gridy++; // Page List listPages.setCellRenderer(new CheckErrorPageListCellRenderer(true)); listPages.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); listPages.addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ @Override public void mouseClicked(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } actionLoadPages(); } }); JScrollPane scrollPages = new JScrollPane(listPages); scrollPages.setMinimumSize(new Dimension(200, 200)); scrollPages.setPreferredSize(new Dimension(200, 300)); scrollPages.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; constraints.weightx = 0; constraints.weighty = 1; panel.add(scrollPages, constraints); constraints.gridy++; return panel; }
Example 19
Source File: ImageEditorComponent.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@SuppressWarnings("unchecked") private void createToolBar() { final JButton zoomIn = new JButton(Icon("zoom-in-2.png")); final JButton zoomOut = new JButton(Icon("zoom-out-2.png")); final JButton resize = new JButton(Icon("transform-scale-2.png")); final JButton rotateLeft = new JButton(Icon("object-rotate-left-2.png")); final JButton mirrorX = new JButton(Icon("mirror_x.png")); final JButton mirrorY = new JButton(Icon("mirror_y.png")); JToolBar toolbar1 = new JToolBar(); toolbar1.add(zoomIn); toolbar1.add(zoomOut); toolbar1.addSeparator(); toolbar1.add(resize); toolbar1.add(rotateLeft); toolbar1.add(mirrorX); toolbar1.add(mirrorY); toolbar1.setFloatable(false); topContainer.add(toolbar1, BorderLayout.CENTER); final ButtonGroup toolsGroup = new ButtonGroup(); final JToggleButton colorPicker = new JToggleButton(Icon("color-picker.png")); final JToggleButton imageCrop = new JToggleButton(Icon("transform-crop.png")); toolsGroup.add(colorPicker); toolsGroup.add(imageCrop); JToolBar toolbar2 = new JToolBar(); toolbar2.setOrientation(JToolBar.VERTICAL); toolbar2.setFloatable(false); toolbar2.add(colorPicker); toolbar2.add(imageCrop); COMPONENT.add(toolbar2, BorderLayout.WEST); ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == zoomIn) { setScaleFactor(getScaleFactor() + 0.1f); } else if (source == zoomOut) { setScaleFactor(getScaleFactor() - 0.1f); } else if (source == resize) { querySizeAndResize(); } else if (source == rotateLeft) { editedImage = RotateLeftFilter.create().filter(editedImage); resizeDisplay(); enableSaving(); } else if (source == mirrorX) { editedImage = MirrorFilter.create().filter(editedImage, MirrorFilter.X); resizeDisplay(); enableSaving(); } else if (source == mirrorY) { editedImage = MirrorFilter.create().filter(editedImage, MirrorFilter.Y); resizeDisplay(); enableSaving(); } else if (source == colorPicker) { setCurrentTool(ColorPicker.create()); } else if (source == imageCrop) { setCurrentTool(CropTool.create()); } } }; for (AbstractButton b : Arrays.asList(zoomIn, zoomOut, resize, /*save, saveAs,*/ rotateLeft, mirrorX, mirrorY, colorPicker, imageCrop)) { b.addActionListener(al); } }
Example 20
Source File: MainModule.java From TinkerTime with GNU General Public License v3.0 | 3 votes |
@Provides public JToolBar createToolBar(ModManager mm, GameLauncher gameLauncher, ConfigData config, InstallationSelectorView installationSelector, SelectedInstallationView installationView, Dialogs dialogs){ JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.add(new Actions.LaunchKspAction(toolBar, mm, gameLauncher, dialogs)).setFocusPainted(false); toolBar.addSeparator(); toolBar.add(new Actions.OpenGameDataFolder(toolBar, mm, config, dialogs)).setFocusPainted(false); toolBar.add(new Actions.LaunchInstallationSelector(toolBar, mm, installationSelector, dialogs)).setFocusPainted(false); toolBar.addSeparator(); toolBar.add(new Actions.AddModAction(toolBar, mm, dialogs)).setFocusPainted(false); toolBar.add(new Actions.AddModZip(toolBar, mm, dialogs)).setFocusPainted(false); toolBar.addSeparator(); toolBar.add(new Actions.UpdateModAction(toolBar, mm, dialogs)).setFocusPainted(false); toolBar.add(new Actions.CheckforUpdatesAction(toolBar, mm, dialogs)).setFocusPainted(false); toolBar.addSeparator(); toolBar.add(installationView.getComponent()); return toolBar; }