Java Code Examples for javax.swing.JToolBar#setPreferredSize()
The following examples show how to use
javax.swing.JToolBar#setPreferredSize() .
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: TestDesignUI.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 6 votes |
private JPanel getTreeInPanel(String labelText, JTree tree) { 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.add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767))); toolBar.add(getPrevoiusTestCaseButton()); toolBar.add(getEditTagButton()); toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 30)); panel.add(toolBar, BorderLayout.NORTH); panel.add(TreeSearch.installFor(tree), BorderLayout.CENTER); return panel; }
Example 2
Source File: TestDesignUI.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 6 votes |
private JPanel getRTreeInPanel(String labelText, JTree tree) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setBorder(BorderFactory.createEtchedBorder()); reusableSwitch = new JButton(labelText); reusableSwitch.setFont(new Font("Default", Font.BOLD, 12)); reusableSwitch.setContentAreaFilled(false); 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(reusableSwitch); toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 30)); panel.add(toolBar, BorderLayout.NORTH); panel.add(TreeSearch.installFor(tree), BorderLayout.CENTER); return panel; }
Example 3
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 4
Source File: TerminalContainerCommon.java From netbeans with Apache License 2.0 | 5 votes |
private void fixSize(JToolBar actionBar) { Insets ins = actionBar.getMargin(); JButton dummy = new JButton(); dummy.setBorderPainted(false); dummy.setOpaque(false); dummy.setText(null); dummy.setIcon(new Icon() { @Override public int getIconHeight() { return 16; } @Override public int getIconWidth() { return 16; } @SuppressWarnings(value = "empty-statement") @Override public void paintIcon(Component c, Graphics g, int x, int y) { ; } }); actionBar.add(dummy); Dimension buttonPref = dummy.getPreferredSize(); Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom); actionBar.setMinimumSize(minDim); actionBar.setPreferredSize(minDim); actionBar.remove(dummy); }
Example 5
Source File: Main_BottomToolbar.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 4 votes |
public Main_BottomToolbar() { toolBar = new JToolBar(); toolBar.setAlignmentX(Component.LEFT_ALIGNMENT); toolBar.setAlignmentY(Component.BOTTOM_ALIGNMENT); toolBar.setPreferredSize(new Dimension(1200, 25)); toolBar.setMinimumSize(new Dimension(800, 25)); toolBar.setAutoscrolls(true); toolBar.setFloatable(false); toolBar.setRollover(true); userIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_user.png"))); toolBar.add(userIconLabel); //initialize weather api for use. liveWeather = new GetLiveWeather(); userLabel = new JLabel(); userLabel.setMaximumSize(new Dimension(160, 19)); userLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); userLabel.setHorizontalTextPosition(SwingConstants.CENTER); userLabel.setHorizontalAlignment(SwingConstants.LEFT); toolBar.add(userLabel); toolBar.addSeparator(); dateIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_calendar.png"))); toolBar.add(dateIconLabel); dateLabel = new JLabel(""); dateLabel.setMaximumSize(new Dimension(160, 19)); dateLabel.setHorizontalTextPosition(SwingConstants.CENTER); dateLabel.setHorizontalAlignment(SwingConstants.LEFT); dateLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); toolBar.add(dateLabel); toolBar.addSeparator(); currencyUsdIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency.png"))); toolBar.add(currencyUsdIcon); currencyUsdLabel = new JLabel(""); currencyUsdLabel.setMaximumSize(new Dimension(160, 19)); currencyUsdLabel.setHorizontalTextPosition(SwingConstants.CENTER); currencyUsdLabel.setHorizontalAlignment(SwingConstants.LEFT); currencyUsdLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); toolBar.add(currencyUsdLabel); toolBar.addSeparator(); currencyEuroIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_euro.png"))); toolBar.add(currencyEuroIcon); currencyEuroLabel = new JLabel(""); currencyEuroLabel.setMaximumSize(new Dimension(160, 19)); currencyEuroLabel.setHorizontalTextPosition(SwingConstants.CENTER); currencyEuroLabel.setHorizontalAlignment(SwingConstants.LEFT); currencyEuroLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); toolBar.add(currencyEuroLabel); toolBar.addSeparator(); currencyPoundIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_pound.png"))); toolBar.add(currencyPoundIcon); currencyPoundLabel = new JLabel(""); currencyPoundLabel.setMaximumSize(new Dimension(160, 19)); currencyPoundLabel.setHorizontalTextPosition(SwingConstants.CENTER); currencyPoundLabel.setHorizontalAlignment(SwingConstants.LEFT); currencyPoundLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); toolBar.add(currencyPoundLabel); toolBar.addSeparator(); hotelIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/login_hotel.png"))); toolBar.add(hotelIconLabel); hotelNameLabel = new JLabel(""); hotelNameLabel.setMaximumSize(new Dimension(160, 19)); hotelNameLabel.setHorizontalTextPosition(SwingConstants.CENTER); hotelNameLabel.setHorizontalAlignment(SwingConstants.LEFT); hotelNameLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); toolBar.add(hotelNameLabel); toolBar.addSeparator(); checkBox = new JCheckBox(""); checkBox.setToolTipText("Enable local weather"); checkBox.addItemListener(showWeather()); toolBar.add(checkBox); weatherIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/toolbar_weather.png"))); toolBar.add(weatherIconLabel); weatherLabel = new JLabel(""); weatherLabel.setPreferredSize(new Dimension(160, 19)); weatherLabel.setHorizontalTextPosition(SwingConstants.CENTER); weatherLabel.setHorizontalAlignment(SwingConstants.LEFT); weatherLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13)); weatherLabel.setEnabled(false); toolBar.add(weatherLabel); }
Example 6
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 7
Source File: NiftyPreviewPanel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
private void createToolbar() { JToolBar toolBar = new JToolBar(); toolBar.setPreferredSize(new Dimension(10000, 24)); toolBar.setMaximumSize(new Dimension(10000, 24)); toolBar.setFloatable(false); JComboBox comboBox = new JComboBox(new String[]{"640x480", "480x800","800x480", "800x600", "1024x768", "1280x720"}); comboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { String string = (String) e.getItem(); final int width; final int height; if ("640x480".equals(string)) { width = 640; height = 480; } else if ("1024x768".equals(string)) { width = 1024; height = 768; } else if ("1280x720".equals(string)) { width = 1280; height = 720; } else if ("800x600".equals(string)) { width = 800; height = 600; } else if ("800x480".equals(string)) { width = 800; height = 480; } else if ("480x800".equals(string)) { width = 480; height = 800; } else { width = 640; height = 480; } offPanel.resizeGLView(width, height); SceneApplication.getApplication().enqueue(new Callable<Object>() { public Object call() throws Exception { niftyDisplay.reshape(offPanel.getViewPort(), width, height); return null; } }); updatePreView(screen); } }); toolBar.add(comboBox); toolBar.add(new JPanel()); add(toolBar); }