List of usage examples for javax.swing JButton setFocusPainted
@BeanProperty(visualUpdate = true, description = "Whether focus should be painted") public void setFocusPainted(boolean b)
paintFocus
property, which must be true
for the focus state to be painted. From source file:Citas.FrameCita.java
private void disenoBotones(JButton actual) { actual.setBackground(colorBotones);/* w w w . ja va2 s . c o m*/ font = font.deriveFont(Font.TYPE1_FONT, 13); actual.setFont(font); actual.setBorderPainted(false); actual.setFocusPainted(false); //actual.setContentAreaFilled(false); actual.setOpaque(false); }
From source file:org.forester.archaeopteryx.ControlPanel.java
void addJButton(final JButton jb, final JPanel p) { jb.setFocusPainted(false); jb.setFont(ControlPanel.jcb_font);// w w w .j a va 2s. c o m if (!_configuration.isUseNativeUI()) { jb.setBorder(BorderFactory.createLineBorder(ControlPanel.button_border_color)); jb.setBackground(ControlPanel.button_background_color); jb.setForeground(ControlPanel.button_text_color); } p.add(jb); jb.addActionListener(this); }
From source file:net.technicpack.launcher.ui.InstallerFrame.java
private void initComponents() { setSize(DIALOG_WIDTH, DIALOG_HEIGHT); setIconImage(resources.getImage("icon.png")); setLayout(new BorderLayout()); JPanel header = new JPanel(); header.setBackground(Color.black); header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS)); header.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8)); add(header, BorderLayout.PAGE_START); JLabel title = new JLabel(resources.getString("launcher.installer.title")); title.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 34)); title.setForeground(LauncherFrame.COLOR_WHITE_TEXT); title.setOpaque(false);/* ww w.ja v a 2 s. c om*/ title.setIcon(resources.getIcon("options_cog.png")); header.add(title); header.add(Box.createHorizontalGlue()); JButton closeButton = new JButton(); closeButton.setIcon(resources.getIcon("close.png")); closeButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); closeButton.setContentAreaFilled(false); closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); closeButton.setFocusPainted(false); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mainFrame.setVisible(true); dispose(); } }); header.add(closeButton); SimpleTabPane centerPanel = new SimpleTabPane(); centerPanel.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL); centerPanel.setForeground(LauncherFrame.COLOR_GREY_TEXT); centerPanel.setSelectedBackground(LauncherFrame.COLOR_BLUE); centerPanel.setSelectedForeground(LauncherFrame.COLOR_WHITE_TEXT); centerPanel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14)); centerPanel.setOpaque(true); add(centerPanel, BorderLayout.CENTER); JPanel standardInstallPanel = new JPanel(); standardInstallPanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE); setupStandardInstall(standardInstallPanel); JPanel portableModePanel = new JPanel(); portableModePanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE); setupPortableMode(portableModePanel); centerPanel.addTab(resources.getString("launcher.installer.standard").toUpperCase(), standardInstallPanel); centerPanel.addTab(resources.getString("launcher.installer.portable").toUpperCase(), portableModePanel); if (settings.isPortable()) { centerPanel.setSelectedIndex(1); } else centerPanel.setSelectedIndex(0); setLocationRelativeTo(null); }
From source file:net.technicpack.launcher.ui.LauncherFrame.java
private void initComponents() { BorderLayout layout = new BorderLayout(); setLayout(layout);//from w w w . java 2 s . co m ///////////////////////////////////////////////////////////// //HEADER ///////////////////////////////////////////////////////////// JPanel header = new JPanel(); header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS)); header.setBackground(COLOR_BLUE); header.setForeground(COLOR_WHITE_TEXT); header.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); this.add(header, BorderLayout.PAGE_START); ImageIcon headerIcon = resources.getIcon("platform_icon_title.png"); JButton headerLabel = new JButton(headerIcon); headerLabel.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0)); headerLabel.setContentAreaFilled(false); headerLabel.setFocusPainted(false); headerLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); headerLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DesktopUtils.browseUrl("http://beta.technicpack.net/"); } }); header.add(headerLabel); header.add(Box.createRigidArea(new Dimension(6, 0))); ActionListener tabListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectTab(e.getActionCommand()); } }; discoverTab = new HeaderTab(resources.getString("launcher.title.discover"), resources); header.add(discoverTab); discoverTab.setActionCommand(TAB_DISCOVER); discoverTab.addActionListener(tabListener); modpacksTab = new HeaderTab(resources.getString("launcher.title.modpacks"), resources); modpacksTab.setIsActive(true); modpacksTab.setHorizontalTextPosition(SwingConstants.LEADING); modpacksTab.addActionListener(tabListener); modpacksTab.setActionCommand(TAB_MODPACKS); header.add(modpacksTab); newsTab = new HeaderTab(resources.getString("launcher.title.news"), resources); newsTab.setLayout(null); newsTab.addActionListener(tabListener); newsTab.setActionCommand(TAB_NEWS); header.add(newsTab); CountCircle newsCircle = new CountCircle(); newsCircle.setBackground(COLOR_RED); newsCircle.setForeground(COLOR_WHITE_TEXT); newsCircle.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS_BOLD, 14)); newsTab.add(newsCircle); newsCircle.setBounds(10, 17, 25, 25); header.add(Box.createHorizontalGlue()); JPanel rightHeaderPanel = new JPanel(); rightHeaderPanel.setOpaque(false); rightHeaderPanel.setLayout(new BoxLayout(rightHeaderPanel, BoxLayout.PAGE_AXIS)); rightHeaderPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel windowGadgetPanel = new JPanel(); windowGadgetPanel.setOpaque(false); windowGadgetPanel.setLayout(new BoxLayout(windowGadgetPanel, BoxLayout.LINE_AXIS)); windowGadgetPanel.setAlignmentX(RIGHT_ALIGNMENT); ImageIcon minimizeIcon = resources.getIcon("minimize.png"); JButton minimizeButton = new JButton(minimizeIcon); minimizeButton.setBorder(BorderFactory.createEmptyBorder()); minimizeButton.setContentAreaFilled(false); minimizeButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); minimizeButton.setFocusable(false); minimizeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { minimizeWindow(); } }); windowGadgetPanel.add(minimizeButton); ImageIcon closeIcon = resources.getIcon("close.png"); JButton closeButton = new JButton(closeIcon); closeButton.setBorder(BorderFactory.createEmptyBorder()); closeButton.setContentAreaFilled(false); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeWindow(); } }); closeButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); closeButton.setFocusable(false); windowGadgetPanel.add(closeButton); rightHeaderPanel.add(windowGadgetPanel); rightHeaderPanel.add(Box.createVerticalGlue()); JButton launcherOptionsLabel = new JButton(resources.getString("launcher.title.options")); launcherOptionsLabel.setIcon(resources.getIcon("options_cog.png")); launcherOptionsLabel.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 14)); launcherOptionsLabel.setForeground(COLOR_WHITE_TEXT); launcherOptionsLabel.setHorizontalAlignment(SwingConstants.RIGHT); launcherOptionsLabel.setHorizontalTextPosition(SwingConstants.LEADING); launcherOptionsLabel.setAlignmentX(RIGHT_ALIGNMENT); launcherOptionsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); launcherOptionsLabel.setBorder(BorderFactory.createEmptyBorder()); launcherOptionsLabel.setContentAreaFilled(false); launcherOptionsLabel.setFocusPainted(false); launcherOptionsLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openLauncherOptions(); } }); rightHeaderPanel.add(launcherOptionsLabel); header.add(rightHeaderPanel); ///////////////////////////////////////////////////////////// // CENTRAL AREA ///////////////////////////////////////////////////////////// centralPanel = new TintablePanel(); centralPanel.setBackground(COLOR_CHARCOAL); centralPanel.setForeground(COLOR_WHITE_TEXT); centralPanel.setTintColor(COLOR_CENTRAL_BACK); this.add(centralPanel, BorderLayout.CENTER); centralPanel.setLayout(new BorderLayout()); modpackPanel = new ModpackInfoPanel(resources, iconRepo, logoRepo, backgroundRepo, avatarRepo, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openModpackOptions((ModpackModel) e.getSource()); } }, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { refreshModpackOptions((ModpackModel) e.getSource()); } }); modpackSelector.setInfoPanel(modpackPanel); playButton = modpackPanel.getPlayButton(); playButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof ModpackModel) { setupPlayButtonText((ModpackModel) e.getSource(), userModel.getCurrentUser()); } else if (installer.isCurrentlyRunning()) { installer.cancel(); setupPlayButtonText(modpackSelector.getSelectedPack(), userModel.getCurrentUser()); } else { launchModpack(); } } }); modpackPanel.getDeleteButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (JOptionPane.showConfirmDialog(LauncherFrame.this, resources.getString("modpackoptions.delete.confirmtext"), resources.getString("modpackoptions.delete.confirmtitle"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { modpackSelector.getSelectedPack().delete(); modpackSelector.forceRefresh(); } } }); infoSwap = new JPanel(); infoLayout = new CardLayout(); infoSwap.setLayout(infoLayout); infoSwap.setOpaque(false); newsInfoPanel = new NewsInfoPanel(resources, avatarRepo); infoSwap.add(discoverInfoPanel, "discover"); JPanel newsHost = new JPanel(); infoSwap.add(newsHost, "news"); JPanel modpackHost = new JPanel(); infoSwap.add(modpackHost, "modpacks"); centralPanel.add(infoSwap, BorderLayout.CENTER); newsSelector = new NewsSelector(resources, newsInfoPanel, platformApi, avatarRepo, newsCircle, settings); newsHost.setLayout(new BorderLayout()); newsHost.add(newsInfoPanel, BorderLayout.CENTER); newsHost.add(newsSelector, BorderLayout.WEST); modpackHost.setLayout(new BorderLayout()); modpackHost.add(modpackPanel, BorderLayout.CENTER); modpackHost.add(modpackSelector, BorderLayout.WEST); footer = new TintablePanel(); footer.setTintColor(COLOR_CENTRAL_BACK); footer.setBackground(COLOR_FOOTER); footer.setLayout(new BoxLayout(footer, BoxLayout.LINE_AXIS)); footer.setForeground(COLOR_WHITE_TEXT); footer.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 12)); userWidget = new UserWidget(resources, skinRepository); userWidget.setMaximumSize(userWidget.getPreferredSize()); footer.add(userWidget); JLabel dashText = new JLabel("| "); dashText.setForeground(LauncherFrame.COLOR_WHITE_TEXT); dashText.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15)); footer.add(dashText); JButton logout = new JButton(resources.getString("launcher.user.logout")); logout.setBorder(BorderFactory.createEmptyBorder()); logout.setContentAreaFilled(false); logout.setFocusable(false); logout.setForeground(LauncherFrame.COLOR_WHITE_TEXT); logout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); logout.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15)); logout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logout(); } }); footer.add(logout); installProgress = new ProgressBar(); installProgress.setForeground(Color.white); installProgress.setBackground(LauncherFrame.COLOR_GREEN); installProgress.setBorder(BorderFactory.createEmptyBorder(5, 45, 4, 45)); installProgress.setIcon(resources.getIcon("download_icon.png")); installProgress.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 12)); installProgress.setVisible(false); footer.add(installProgress); installProgressPlaceholder = Box.createHorizontalGlue(); footer.add(installProgressPlaceholder); JLabel buildCtrl = new JLabel(resources.getString("launcher.build.text", resources.getLauncherBuild(), resources.getString("launcher.build." + settings.getBuildStream()))); buildCtrl.setForeground(COLOR_WHITE_TEXT); buildCtrl.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14)); buildCtrl.setHorizontalTextPosition(SwingConstants.RIGHT); buildCtrl.setHorizontalAlignment(SwingConstants.RIGHT); footer.add(buildCtrl); this.add(footer, BorderLayout.PAGE_END); }
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Create a button with the netscape style * * @param name/*from w w w . ja v a2s . c o m*/ * Description of Parameter * @param listener * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used */ @Deprecated public static JButton createButton(String name, ActionListener listener) { JButton button = new JButton(getImage(name + ".on.gif")); // $NON-NLS-1$ button.setDisabledIcon(getImage(name + ".off.gif")); // $NON-NLS-1$ button.setRolloverIcon(getImage(name + ".over.gif")); // $NON-NLS-1$ button.setPressedIcon(getImage(name + ".down.gif")); // $NON-NLS-1$ button.setActionCommand(name); button.addActionListener(listener); button.setRolloverEnabled(true); button.setFocusPainted(false); button.setBorderPainted(false); button.setOpaque(false); button.setPreferredSize(new Dimension(24, 24)); return button; }
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Create a button with the netscape style * * @param name/* w w w.j a va2s . com*/ * Description of Parameter * @param listener * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used */ @Deprecated public static JButton createSimpleButton(String name, ActionListener listener) { JButton button = new JButton(getImage(name + ".gif")); // $NON-NLS-1$ button.setActionCommand(name); button.addActionListener(listener); button.setFocusPainted(false); button.setBorderPainted(false); button.setOpaque(false); button.setPreferredSize(new Dimension(25, 25)); return button; }
From source file:org.datavyu.views.DataControllerV.java
/** * Helper method for Building a button for the data controller - sets the * icon, selected icon, action map and name. * * @param rMap The resource map that holds the icons for this button. * @param aMap The action map holding the action that this button invokes. * @param name The prefix to use when looking for actions and buttons. * @param modifier The modifier (if any) to apply to the prefix. Maybe null. * * @return A configured button./*from w ww. ja v a 2 s . c o m*/ */ private JButton buildButton(final ResourceMap rMap, final ActionMap aMap, final String name, final String modifier) { JButton result = new JButton(); result.setAction(aMap.get(name + "Action")); if (modifier == null) { result.setIcon(rMap.getIcon(name + "Button.icon")); result.setPressedIcon(rMap.getIcon(name + "SelectedButton.icon")); } else { result.setIcon(rMap.getIcon(modifier + name + "Button.icon")); result.setPressedIcon(rMap.getIcon(modifier + name + "SelectedButton.icon")); } result.setFocusPainted(false); result.setName(name + "Button"); return result; }
From source file:org.datavyu.views.DataControllerV.java
/** * Initialize the view for Macs.//from w w w .j av a2s. c om */ private void initComponentsMac() { gridButtonPanel = new javax.swing.JPanel(); goBackTextField = new javax.swing.JTextField(); findTextField = new javax.swing.JTextField(); addDataButton = new javax.swing.JButton(); timestampLabel = new javax.swing.JLabel(); lblSpeed = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); findOffsetField = new javax.swing.JTextField(); showTracksButton = new javax.swing.JButton(); tracksPanel = new javax.swing.JPanel(new MigLayout("fill")); final int fontSize = 11; org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(org.datavyu.Datavyu.class).getContext().getResourceMap(DataControllerV.class); setTitle(resourceMap.getString("title")); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(final java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); gridButtonPanel.setBackground(Color.WHITE); gridButtonPanel.setLayout(new MigLayout("wrap 5, ins 15 2 15 2")); // Add data button addDataButton.setText(resourceMap.getString("addDataButton.text")); addDataButton.setFont(new Font("Tahoma", Font.PLAIN, fontSize)); addDataButton.setFocusPainted(false); addDataButton.setName("addDataButton"); addDataButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { openVideoButtonActionPerformed(evt); } }); gridButtonPanel.add(addDataButton, "span 2, w 90!, h 25!"); // Timestamp panel JPanel timestampPanel = new JPanel(new MigLayout("", "push[][][]0![]push")); timestampPanel.setOpaque(false); // Timestamp label timestampLabel.setFont(new Font("Tahoma", Font.BOLD, fontSize)); timestampLabel.setHorizontalAlignment(SwingConstants.CENTER); timestampLabel.setText("00:00:00:000"); timestampLabel.setHorizontalTextPosition(SwingConstants.CENTER); timestampLabel.setName("timestampLabel"); timestampPanel.add(timestampLabel); jLabel1.setText("@"); timestampPanel.add(jLabel1); lblSpeed.setFont(new Font("Tahoma", Font.BOLD, fontSize)); lblSpeed.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 2)); lblSpeed.setName("lblSpeed"); lblSpeed.setText("0"); timestampPanel.add(lblSpeed); jLabel2.setFont(new Font("Tahoma", Font.BOLD, fontSize)); jLabel2.setText("x"); timestampPanel.add(jLabel2); // Set cell onset button javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(org.datavyu.Datavyu.class).getContext().getActionMap(DataControllerV.class, this); gridButtonPanel.add(timestampPanel, "span 3, pushx, growx"); // placeholder setCellOnsetButton = buildButton(resourceMap, actionMap, "setCellOnset", null); gridButtonPanel.add(setCellOnsetButton, "w 45!, h 45!"); // Sync button pointCellButton = buildButton(resourceMap, actionMap, "pointCell", null); gridButtonPanel.add(pointCellButton, "w 45!, h 45!"); // Set cell onset button. osxsetCellOffsetButton = buildButton(resourceMap, actionMap, "setCellOffset", "osx"); gridButtonPanel.add(osxsetCellOffsetButton, "w 45!, h 45!"); // Instant cell button. JButton placeholder2 = new JButton(); placeholder2.setEnabled(false); placeholder2.setFocusPainted(false); gridButtonPanel.add(placeholder2, "w 45!, h 45!"); // Sync video button JButton placeholder3 = new JButton(); placeholder3.setEnabled(false); placeholder3.setFocusPainted(false); gridButtonPanel.add(placeholder3, "w 80!, h 45!"); // Rewind video button rewindButton = buildButton(resourceMap, actionMap, "rewind", null); gridButtonPanel.add(rewindButton, "w 45!, h 45!"); // Play video button playButton = buildButton(resourceMap, actionMap, "play", null); playButton.setRequestFocusEnabled(false); gridButtonPanel.add(playButton, "w 45!, h 45!"); // Fast forward button forwardButton = buildButton(resourceMap, actionMap, "forward", null); gridButtonPanel.add(forwardButton, "w 45!, h 45!"); // Go back button goBackButton = buildButton(resourceMap, actionMap, "goBack", null); gridButtonPanel.add(goBackButton, "w 45!, h 45!"); // Go back text field goBackTextField.setHorizontalAlignment(SwingConstants.CENTER); goBackTextField.setText("00:00:05:000"); goBackTextField.setName("goBackTextField"); gridButtonPanel.add(goBackTextField, "w 80!, h 45!"); // Shuttle back button shuttleBackButton = buildButton(resourceMap, actionMap, "shuttleBack", null); gridButtonPanel.add(shuttleBackButton, "w 45!, h 45!"); // Stop button stopButton = buildButton(resourceMap, actionMap, "stop", null); gridButtonPanel.add(stopButton, "w 45!, h 45!"); // Shuttle forward button shuttleForwardButton = buildButton(resourceMap, actionMap, "shuttleForward", null); gridButtonPanel.add(shuttleForwardButton, "w 45!, h 45!"); // Find button findButton = buildButton(resourceMap, actionMap, "find", null); gridButtonPanel.add(findButton, "w 45!, h 45!"); // Find text field findTextField.setHorizontalAlignment(SwingConstants.CENTER); findTextField.setText("00:00:00:000"); findTextField.setName("findOnsetLabel"); gridButtonPanel.add(findTextField, "w 80!, h 45!"); // Jog back button jogBackButton = buildButton(resourceMap, actionMap, "jogBack", null); gridButtonPanel.add(jogBackButton, "w 45!, h 45!"); // Pause button pauseButton = buildButton(resourceMap, actionMap, "pause", null); gridButtonPanel.add(pauseButton, "w 45!, h 45!"); // Jog forward button jogForwardButton = buildButton(resourceMap, actionMap, "jogForward", null); gridButtonPanel.add(jogForwardButton, "w 45!, h 45!"); // Create new cell button createNewCell = buildButton(resourceMap, actionMap, "createNewCell", null); createNewCell.setAlignmentY(0.0F); createNewCell.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); gridButtonPanel.add(createNewCell, "span 1 2, w 45!, h 92!"); // Find offset field findOffsetField.setHorizontalAlignment(SwingConstants.CENTER); findOffsetField.setText("00:00:00:000"); findOffsetField.setToolTipText(resourceMap.getString("findOffsetField.toolTipText")); findOffsetField.setEnabled(false); findOffsetField.setName("findOffsetLabel"); gridButtonPanel.add(findOffsetField, "w 80!, h 45!"); // Create new cell setting offset button createNewCellSettingOffset = buildButton(resourceMap, actionMap, "createNewCellAndSetOnset", null); gridButtonPanel.add(createNewCellSettingOffset, "span 2, w 92!, h 45!"); // Set cell offset button setCellOffsetButton = buildButton(resourceMap, actionMap, "setCellOffset", null); gridButtonPanel.add(setCellOffsetButton, "w 45!, h 45!"); // Show tracks button showTracksButton.setIcon(resourceMap.getIcon("showTracksButton.hide.icon")); showTracksButton.setName("showTracksButton"); showTracksButton.getAccessibleContext().setAccessibleName("Show Tracks"); showTracksButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { showTracksButtonActionPerformed(evt); } }); gridButtonPanel.add(showTracksButton, "w 80!, h 45!"); getContentPane().setLayout(new MigLayout("hidemode 3, fillx", "[growprio 0]0[]", "")); getContentPane().add(gridButtonPanel, ""); getContentPane().setBackground(Color.WHITE); tracksPanel.setBackground(Color.WHITE); tracksPanel.setVisible(false); getContentPane().add(tracksPanel, "growx"); pack(); }
From source file:org.datavyu.views.DataControllerV.java
/** * Initialize the view for OS other than Macs. *//* w ww . java 2 s . co m*/ private void initComponents() { gridButtonPanel = new javax.swing.JPanel(); goBackTextField = new javax.swing.JTextField(); findTextField = new javax.swing.JTextField(); addDataButton = new javax.swing.JButton(); timestampLabel = new javax.swing.JLabel(); lblSpeed = new javax.swing.JLabel(); createNewCell = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); findOffsetField = new javax.swing.JTextField(); showTracksButton = new javax.swing.JButton(); tracksPanel = new javax.swing.JPanel(new MigLayout("fill")); final int fontSize = 11; org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(org.datavyu.Datavyu.class).getContext().getResourceMap(DataControllerV.class); setTitle(resourceMap.getString("title")); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(final java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); gridButtonPanel.setBackground(Color.WHITE); gridButtonPanel.setLayout(new MigLayout("wrap 5")); // Add data button addDataButton.setText(resourceMap.getString("addDataButton.text")); addDataButton.setFont(new Font("Tahoma", Font.PLAIN, fontSize)); addDataButton.setFocusPainted(false); addDataButton.setName("addDataButton"); addDataButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { openVideoButtonActionPerformed(evt); } }); gridButtonPanel.add(addDataButton, "span 2, w 90!, h 25!"); // Timestamp panel JPanel timestampPanel = new JPanel(new MigLayout("", "push[][][]0![]push")); timestampPanel.setOpaque(false); // Timestamp label timestampLabel.setFont(new Font("Tahoma", Font.BOLD, fontSize)); timestampLabel.setHorizontalAlignment(SwingConstants.CENTER); timestampLabel.setText("00:00:00:000"); timestampLabel.setHorizontalTextPosition(SwingConstants.CENTER); timestampLabel.setName("timestampLabel"); timestampPanel.add(timestampLabel); jLabel1.setText("@"); timestampPanel.add(jLabel1); lblSpeed.setFont(new Font("Tahoma", Font.BOLD, fontSize)); lblSpeed.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 2)); lblSpeed.setName("lblSpeed"); lblSpeed.setText("0"); timestampPanel.add(lblSpeed); jLabel2.setFont(new Font("Tahoma", Font.BOLD, fontSize)); jLabel2.setText("x"); timestampPanel.add(jLabel2); javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(org.datavyu.Datavyu.class).getContext().getActionMap(DataControllerV.class, this); gridButtonPanel.add(timestampPanel, "span 3, pushx, growx"); JButton placeholder = new JButton(); placeholder.setEnabled(false); placeholder.setFocusPainted(false); gridButtonPanel.add(placeholder, "w 45!, h 45!"); // Set cell onset button setCellOnsetButton = buildButton(resourceMap, actionMap, "setCellOnset", "win"); gridButtonPanel.add(setCellOnsetButton, "w 45!, h 45!"); // Set new cell offset button pointCellButton = buildButton(resourceMap, actionMap, "pointCell", "win"); gridButtonPanel.add(pointCellButton, "w 45!, h 45!"); // Go back button goBackButton = buildButton(resourceMap, actionMap, "goBack", null); gridButtonPanel.add(goBackButton, "w 45!, h 45!"); // Sync video button JButton placeholder2 = new JButton(); placeholder2.setEnabled(false); placeholder2.setFocusPainted(false); gridButtonPanel.add(placeholder2, "w 80!, h 45!"); // Rewind video button rewindButton = buildButton(resourceMap, actionMap, "rewind", null); gridButtonPanel.add(rewindButton, "w 45!, h 45!"); // Play video button playButton = buildButton(resourceMap, actionMap, "play", null); playButton.setRequestFocusEnabled(false); gridButtonPanel.add(playButton, "w 45!, h 45!"); // Fast forward button forwardButton = buildButton(resourceMap, actionMap, "forward", null); gridButtonPanel.add(forwardButton, "w 45!, h 45!"); // Find button findButton = buildButton(resourceMap, actionMap, "find", "win"); gridButtonPanel.add(findButton, "span 1 2, w 45!, h 95!"); // Go back text field goBackTextField.setHorizontalAlignment(SwingConstants.CENTER); goBackTextField.setText("00:00:05:000"); goBackTextField.setName("goBackTextField"); gridButtonPanel.add(goBackTextField, "w 80!, h 45!"); // Shuttle back button shuttleBackButton = buildButton(resourceMap, actionMap, "shuttleBack", null); gridButtonPanel.add(shuttleBackButton, "w 45!, h 45!"); // Stop button stopButton = buildButton(resourceMap, actionMap, "stop", null); gridButtonPanel.add(stopButton, "w 45!, h 45!"); // Shuttle forward button shuttleForwardButton = buildButton(resourceMap, actionMap, "shuttleForward", null); gridButtonPanel.add(shuttleForwardButton, "w 45!, h 45!"); // Find text field findTextField.setHorizontalAlignment(SwingConstants.CENTER); findTextField.setText("00:00:00:000"); findTextField.setName("findOnsetLabel"); gridButtonPanel.add(findTextField, "w 80!, h 45!"); // Jog back button jogBackButton = buildButton(resourceMap, actionMap, "jogBack", null); gridButtonPanel.add(jogBackButton, "w 45!, h 45!"); // Pause button pauseButton = buildButton(resourceMap, actionMap, "pause", null); gridButtonPanel.add(pauseButton, "w 45!, h 45!"); // Jog forward button jogForwardButton = buildButton(resourceMap, actionMap, "jogForward", null); gridButtonPanel.add(jogForwardButton, "w 45!, h 45!"); // Create new cell button createNewCell = buildButton(resourceMap, actionMap, "createNewCell", null); createNewCell.setAlignmentY(0.0F); createNewCell.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); gridButtonPanel.add(createNewCell, "span 1 2, w 45!, h 95!"); // Find offset field findOffsetField.setHorizontalAlignment(SwingConstants.CENTER); findOffsetField.setText("00:00:00:000"); findOffsetField.setToolTipText(resourceMap.getString("findOffsetField.toolTipText")); findOffsetField.setEnabled(false); findOffsetField.setName("findOffsetLabel"); gridButtonPanel.add(findOffsetField, "w 80!, h 45!"); // Create new cell setting offset button createNewCellSettingOffset = buildButton(resourceMap, actionMap, "createNewCellAndSetOnset", null); gridButtonPanel.add(createNewCellSettingOffset, "span 2, w 95!, h 45!"); // Set cell offset button setCellOffsetButton = buildButton(resourceMap, actionMap, "setCellOffset", null); gridButtonPanel.add(setCellOffsetButton, "w 45!, h 45!"); // Show tracks button showTracksButton.setIcon(resourceMap.getIcon("showTracksButton.hide.icon")); showTracksButton.setName("showTracksButton"); showTracksButton.getAccessibleContext().setAccessibleName("Show Tracks"); showTracksButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { showTracksButtonActionPerformed(evt); } }); gridButtonPanel.add(showTracksButton, "w 80!, h 45!"); getContentPane().setLayout(new MigLayout("ins 0, hidemode 3, fillx", "[growprio 0]0[]", "")); getContentPane().add(gridButtonPanel, ""); getContentPane().setBackground(Color.WHITE); tracksPanel.setBackground(Color.WHITE); tracksPanel.setVisible(false); getContentPane().add(tracksPanel, "growx"); pack(); }
From source file:org.eobjects.datacleaner.windows.AnalysisJobBuilderWindowImpl.java
private JButton createToolBarButton(String text, ImageIcon imageIcon) { final JButton button = new JButton(text, imageIcon); button.setForeground(WidgetUtils.BG_COLOR_BRIGHTEST); button.setFocusPainted(false); return button; }