Java Code Examples for javax.swing.JButton#setIcon()

The following examples show how to use javax.swing.JButton#setIcon() . 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: ButtonFactory.java    From openAGV with Apache License 2.0 6 votes vote down vote up
private static JButton createFontStyleItalicButton(DrawingEditor editor) {
  JButton button = new JButton();
  button.setIcon(ImageDirectory.getImageIcon("/toolbar/attributeFontItalic.png"));
  button.setText(null);
  button.setToolTipText(BUNDLE.getString("buttonFactory.button_fontStyleItalic.tooltipText"));
  button.setFocusable(false);

  AbstractAction action
      = new AttributeToggler<>(editor,
                               AttributeKeys.FONT_ITALIC,
                               Boolean.TRUE,
                               Boolean.FALSE,
                               new StyledEditorKit.BoldAction());
  action.putValue(ActionUtil.UNDO_PRESENTATION_NAME_KEY,
                  BUNDLE.getString("buttonFactory.action_fontStyleItalic.undo.presentationName"));
  button.addActionListener(action);

  return button;
}
 
Example 2
Source File: DrawingViewPlacardPanel.java    From openAGV with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a button that zooms the drawing to a scale factor so that
 * it fits the window size.
 *
 * @return The created button.
 */
private JButton zoomViewToWindowButton(final OpenTCSDrawingView drawingView) {
  final JButton button = new JButton();

  button.setToolTipText(
      labels.getString("drawingViewPlacardPanel.button_zoomViewToWindow.tooltipText")
  );

  button.setIcon(ImageDirectory.getImageIcon("/menu/zoom-fit-best-4.png"));

  button.setMargin(new Insets(0, 0, 0, 0));
  button.setFocusable(false);

  button.addActionListener((ActionEvent e) -> drawingView.zoomViewToWindow());

  return button;
}
 
Example 3
Source File: ShapeBoard.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Define the global panel of ranges.
 *
 * @return the global panel of ranges
 */
private Panel defineRangesPanel ()
{
    Panel panel = new Panel();
    panel.setNoInsets();
    panel.setPreferredSize(new Dimension(BOARD_WIDTH, 180));

    FlowLayout layout = new FlowLayout();
    layout.setAlignment(FlowLayout.LEADING);
    panel.setLayout(layout);

    for (ShapeSet range : ShapeSet.getShapeSets()) {
        Shape rep = range.getRep();

        if (rep != null) {
            JButton button = new JButton();
            button.setIcon(rep.getDecoratedSymbol());
            button.setName(range.getName());
            button.addActionListener(rangeListener);
            button.setToolTipText(range.getName());
            button.setBorderPainted(false);
            panel.add(button);
        }
    }

    return panel;
}
 
Example 4
Source File: DatabaseViewer.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
protected void setViewQueryButton( JButton _viewQueryButton, Dimension preferredButtonSize, JTextPane sqlEditorArea ) {
    _viewQueryButton.setIcon(ImageCache.getInstance().getImage(ImageCache.GLOBE));
    _viewQueryButton.setToolTipText(VIEW_QUERY_TOOLTIP);
    _viewQueryButton.setText("");
    _viewQueryButton.setPreferredSize(preferredButtonSize);
    _viewQueryButton.addActionListener(e -> {

        String sqlText = sqlEditorArea.getText().trim();
        if (sqlText.length() > 0) {
            if (!sqlText.toLowerCase().startsWith("select")) {
                JOptionPane.showMessageDialog(this, "Viewing of data is allowed only for SELECT statements.", "WARNING",
                        JOptionPane.WARNING_MESSAGE, null);
                return;
            }
        }

        final LogConsoleController logConsole = new LogConsoleController(pm);
        JFrame window = guiBridge.showWindow(logConsole.asJComponent(), "Console Log");
        new Thread(() -> {
            boolean hadErrors = false;
            try {
                logConsole.beginProcess("Run query");
                hadErrors = viewSpatialQueryResult(null, sqlText, pm, false);
            } catch (Exception ex) {
                pm.errorMessage(ex.getLocalizedMessage());
                hadErrors = true;
            } finally {
                logConsole.finishProcess();
                logConsole.stopLogging();
                if (!hadErrors) {
                    logConsole.setVisible(false);
                    window.dispose();
                }
            }
        }, "DatabaseViewer->run query and view geometries").start();
    });
}
 
Example 5
Source File: ComponentSource.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component getForwardButton() {
  final JButton button = new JButton();
  button.setAction(this.actionPool.forwardAction);
  button.setIcon(IconFactory.getInstance().getIcon("/images/forward.gif"));
  button.setToolTipText("Forward");
  return button;
}
 
Example 6
Source File: OutlookBarMain.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
void addTab(JOutlookBar tabs, String title) {
  JPanel panel = new JPanel();
  panel.setLayout(new PercentLayout(PercentLayout.VERTICAL, 0));
  panel.setOpaque(false);

  String[] buttons = new String[] {"Inbox", "icons/outlook-inbox.gif",
    "Outbox", "icons/outlook-outbox.gif", "Drafts", "icons/outlook-inbox.gif",
    "Templates", "icons/outlook-inbox.gif", "Deleted Items",
    "icons/outlook-trash.gif",};

  for (int i = 0, c = buttons.length; i < c; i += 2) {
    JButton button = new JButton(buttons[i]);
    try {
      button.setUI((ButtonUI)Class.forName(
        (String)UIManager.get("OutlookButtonUI")).newInstance());
    } catch (Exception e) {
      e.printStackTrace();
    }
    button.setIcon(new ImageIcon(OutlookBarMain.class
      .getResource(buttons[i + 1])));
    panel.add(button);
  }

  JScrollPane scroll = tabs.makeScrollPane(panel);
  tabs.addTab("", scroll);

  // this to test the UI gets notified of changes
  int index = tabs.indexOfComponent(scroll);
  tabs.setTitleAt(index, title);
  tabs.setToolTipTextAt(index, title + " Tooltip");
}
 
Example 7
Source File: Help.java    From FancyBing with GNU General Public License v3.0 5 votes vote down vote up
private JButton createToolBarButton(String icon, String command,
                                    String toolTip)
{
    JButton button = new JButton();
    button.setActionCommand(command);
    button.setToolTipText(i18n(toolTip));
    button.addActionListener(this);
    button.setIcon(GuiUtil.getIcon(icon, command));
    button.setFocusable(false);
    return button;
}
 
Example 8
Source File: TypeSelectionView.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
private JButton createDataSourceSelectionButton(@SuppressWarnings("rawtypes") final DataSourceFactory factory) {
	String label = DataImportWizardUtils.getFactoryLabel(factory);
	String description = DataImportWizardUtils.getFactoryDescription(factory);

	JButton typeSelectionButton = new JButton(new AbstractAction() {

		private static final long serialVersionUID = 1L;

		@Override
		@SuppressWarnings("unchecked")
		public void actionPerformed(ActionEvent e) {
			enableDataSourceButtons(false);

			// update the wizard by setting the selected factory
			wizard.setDataSource(factory.createNew(), factory);

			// switch to the next wizard step (location selection)
			wizard.nextStep();
		}

	});

	typeSelectionButton.setText(label);
	typeSelectionButton.setToolTipText(description);

	typeSelectionButton.setMinimumSize(TYPE_BUTTON_DIMENSION);
	typeSelectionButton.setPreferredSize(TYPE_BUTTON_DIMENSION);
	typeSelectionButton.setMaximumSize(TYPE_BUTTON_DIMENSION);
	typeSelectionButton.setIcon(DataImportWizardUtils.getFactoryIcon(factory));

	return typeSelectionButton;
}
 
Example 9
Source File: ComponentSource.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component getBackButton() {
  final JButton button = new JButton();
  button.setAction(this.actionPool.backAction);
  button.setIcon(IconFactory.getInstance().getIcon("/images/back.gif"));
  button.setToolTipText("Back");
  return button;
}
 
Example 10
Source File: ManualHttpRequestEditorPanel.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
@Override
protected Component getManualSendPanel() {
    if (requestResponsePanel == null) {
        requestResponsePanel =
                new RequestResponsePanel(
                        configurationKey, getRequestPanel(), getResponsePanel());

        if (helpKey != null) {
            JButton helpButton = new JButton();
            helpButton.setIcon(ExtensionHelp.getHelpIcon());
            helpButton.setToolTipText(
                    Constant.messages.getString("help.dialog.button.tooltip"));
            helpButton.addActionListener(
                    new java.awt.event.ActionListener() {
                        @Override
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                            ExtensionHelp.showHelp(helpKey);
                        }
                    });
            requestResponsePanel.addToolbarButton(helpButton);
        }

        requestResponsePanel.addEndButton(getBtnSend());
        requestResponsePanel.addSeparator();

        requestResponsePanel.loadConfig();
    }
    return requestResponsePanel;
}
 
Example 11
Source File: JDateChooser.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
public JDateChooser(boolean allowEmptyDates) {
	super(new DefaultDatePickerSettings(allowEmptyDates));

	JTextField jTextField = getComponentDateTextField();
	jTextField.setEditable(false);
	jTextField.setBorder(null);
	jTextField.setOpaque(false);
	jTextField.setHorizontalAlignment(JTextField.CENTER);
	JButton jButton = getComponentToggleCalendarButton();
	jButton.setIcon(Images.EDIT_DATE.getIcon());
	jButton.setText("");
}
 
Example 12
Source File: MainMenuJPanel.java    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
private synchronized void initEquipmentButtons(JButton[] buttons) {
    if (!initializedEquipmentButtons) {
        for (JButton button : buttons) {
            button.setIcon(new ImageIcon(MainMenuJPanel.this.mil2525CSymbolController.getSymbolImage(button.getText())));
        }
        initializedEquipmentButtons = true;
    }
}
 
Example 13
Source File: Operation.java    From cstc with GNU General Public License v3.0 5 votes vote down vote up
private JButton createIconButton(ImageIcon icon) {
	JButton btn = new JButton();
	btn.setBorder(BorderFactory.createEmptyBorder());
	btn.setIcon(icon);
	btn.setContentAreaFilled(false);
	btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
	btn.setAlignmentX(Component.RIGHT_ALIGNMENT);

	return btn;
}
 
Example 14
Source File: hover_press_utilclass.java    From java-QQ- with Apache License 2.0 5 votes vote down vote up
public static JButton getbtnIcon(String iconpath)
{
	JButton button=new JButton();
	button.setIcon(new ImageIcon(iconpath));
	button.setBorder(null);
	button.setFocusPainted(false);
	button.setContentAreaFilled(false);
	
	return button;
}
 
Example 15
Source File: AttributeStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

			private static final long serialVersionUID = -6953213567063104487L;

			@Override
			public Dimension getPreferredSize() {
				return DIMENSION_CHART_PANEL_ENLARGED;
			}
		};
		chartPanel.setPopupMenu(null);
		chartPanel.setBackground(COLOR_TRANSPARENT);
		chartPanel.setOpaque(false);
		chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		panel.add(chartPanel, BorderLayout.CENTER);

		JPanel openChartPanel = new JPanel(new GridBagLayout());
		openChartPanel.setOpaque(false);

		GridBagConstraints gbc = new GridBagConstraints();
		gbc.anchor = GridBagConstraints.CENTER;
		gbc.fill = GridBagConstraints.NONE;
		gbc.weightx = 1.0;
		gbc.weighty = 1.0;

		JButton openChartButton = new JButton(OPEN_CHART_ACTION);
		openChartButton.setOpaque(false);
		openChartButton.setContentAreaFilled(false);
		openChartButton.setBorderPainted(false);
		openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
		openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
		openChartButton.setIcon(null);
		Font font = openChartButton.getFont();
		Map attributes = font.getAttributes();
		attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
		openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

		openChartPanel.add(openChartButton, gbc);

		panel.add(openChartPanel, BorderLayout.SOUTH);
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 16
Source File: BrowserAddonDlg.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
private void initUI() {
	setUndecorated(true);

	try {
		if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
				.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
			if (!Config.getInstance().isNoTransparency()) {
				setOpacity(0.85f);
			}
		}
	} catch (Exception e) {
		Logger.log(e);
	}

	setIconImage(ImageResource.getImage("icon.png"));
	setSize(getScaledInt(400), getScaledInt(300));
	setLocationRelativeTo(null);
	setAlwaysOnTop(true);
	getContentPane().setLayout(null);
	getContentPane().setBackground(ColorResource.getDarkestBgColor());

	JPanel titlePanel = new TitlePanel(null, this);
	titlePanel.setOpaque(false);
	titlePanel.setBounds(0, 0, getScaledInt(400), getScaledInt(50));

	JButton closeBtn = new CustomButton();
	closeBtn.setBounds(getScaledInt(365), getScaledInt(5), getScaledInt(30), getScaledInt(30));
	closeBtn.setBackground(ColorResource.getDarkestBgColor());
	closeBtn.setBorderPainted(false);
	closeBtn.setFocusPainted(false);
	closeBtn.setName("CLOSE");

	closeBtn.setIcon(ImageResource.getIcon("title_close.png", 20, 20));
	closeBtn.addActionListener(this);
	titlePanel.add(closeBtn);

	JLabel titleLbl = new JLabel(StringResource.get("BROWSER_MONITORING"));
	titleLbl.setFont(FontResource.getBiggerFont());
	titleLbl.setForeground(ColorResource.getSelectionColor());
	titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(200), getScaledInt(30));
	titlePanel.add(titleLbl);

	JLabel lineLbl = new JLabel();
	lineLbl.setBackground(ColorResource.getSelectionColor());
	lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 1);
	lineLbl.setOpaque(true);
	add(lineLbl);
	add(titlePanel);

	int y = getScaledInt(65);
	int h = getScaledInt(50);
	JTextArea lblMonitoringTitle = new JTextArea();
	lblMonitoringTitle.setOpaque(false);
	lblMonitoringTitle.setWrapStyleWord(true);
	lblMonitoringTitle.setLineWrap(true);
	lblMonitoringTitle.setEditable(false);
	lblMonitoringTitle.setForeground(Color.WHITE);
	lblMonitoringTitle.setText(this.desc);
	lblMonitoringTitle.setFont(FontResource.getNormalFont());
	lblMonitoringTitle.setBounds(getScaledInt(15), y, getScaledInt(370) - getScaledInt(30), h);
	add(lblMonitoringTitle);
	y += h;

	JButton btViewMonitoring = createButton1("CTX_COPY_URL", getScaledInt(15), y);
	btViewMonitoring.setName("COPY");
	add(btViewMonitoring);
	y += btViewMonitoring.getHeight();

}
 
Example 17
Source File: SelectIndicatorSettingsWizardPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
private void init() {
	setLayout(new GridBagLayout());  
	
	JLabel titleLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.title"));
	titleField = new JTextField();
	titleField.setPreferredSize(txtDim);
	titleField.setMinimumSize(txtDim);
	
	JLabel descLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.description"));
	descField = new JTextField();
	descField.setPreferredSize(txtDim);
	descField.setMinimumSize(txtDim);
	
	JLabel unitLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.unit"));
	unitField = new JTextField();
	unitField.setPreferredSize(txtDim);
	unitField.setMinimumSize(txtDim);
	
	JLabel minLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.min"));
	minField = new JTextField();
	minField.setPreferredSize(txtDim);
	minField.setMinimumSize(txtDim);
	
	JLabel maxLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.max"));
	maxField = new JTextField();
	maxField.setPreferredSize(txtDim);
	maxField.setMinimumSize(txtDim);
	
	showMinMax = new JCheckBox(I18NSupport.getString("wizard.panel.indicator.data.show"));
	shadow = new JCheckBox(I18NSupport.getString("wizard.panel.display.shadow"));
	
	JLabel colorLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.color"));
	colorField = new JTextField();
	colorField.setEditable(false);
	colorField.setPreferredSize(txtDim);
	colorField.setMinimumSize(txtDim);
	JButton colorButton = new JButton();
	colorButton.setPreferredSize(buttonDim);
	colorButton.setMinimumSize(buttonDim);
	colorButton.setMaximumSize(buttonDim);
	colorButton.setIcon(ImageUtil.getImageIcon("copy_settings"));
	colorButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			Color color = ExtendedColorChooser.showDialog(SwingUtilities.getWindowAncestor(SelectIndicatorSettingsWizardPanel.this), 
					I18NSupport.getString("color.dialog.title"), null);
			if (color != null) {
				colorField.setText(String.valueOf(color.getRGB()));	
				colorField.setBackground(color);
			}
		}			
	});		
	
	JLabel imageLabel = new JLabel(ImageUtil.getImageIcon("indicator_main"));
	imageLabel.setPreferredSize(new Dimension(280, 170));
	
	add(titleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(titleField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(imageLabel, new GridBagConstraints(3, 0, 1, 9, 1.0, 1.0,  GridBagConstraints.CENTER, 
			GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
	add(descLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(descField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(unitLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(unitField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(minLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(minField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(maxLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(maxField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(showMinMax, new GridBagConstraints(0, 5, 2, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(shadow, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));		
	add(colorLabel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(colorField, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(colorButton, new GridBagConstraints(2, 7, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
}
 
Example 18
Source File: TlsDebugPanel.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public TlsDebugPanel(ExtensionTlsDebug extension) {
    super();
    this.extension = extension;

    this.setIcon(TLSDEBUG_ICON);
    this.setDefaultAccelerator(
            this.extension
                    .getView()
                    .getMenuShortcutKeyStroke(KeyEvent.VK_D, KeyEvent.ALT_DOWN_MASK, false));
    this.setLayout(new BorderLayout());

    JPanel panelContent = new JPanel(new GridBagLayout());
    this.add(panelContent, BorderLayout.NORTH);

    panelContent.setBackground(new Color(UIManager.getColor("TextField.background").getRGB()));
    panelContent.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    panelContent.add(
            new JLabel(Constant.messages.getString("tlsdebug.label.url")),
            LayoutHelper.getGBC(0, 0, 1, 0.0D, new Insets(5, 5, 5, 5)));

    JPanel urlSelectPanel = new JPanel(new GridBagLayout());
    JButton selectButton = new JButton(Constant.messages.getString("all.button.select"));
    selectButton.setIcon(
            DisplayUtils.getScaledIcon(
                    new ImageIcon(
                            View.class.getResource("/resource/icon/16/094.png")))); // Globe
    // icon
    selectButton.addActionListener(
            new java.awt.event.ActionListener() {
                @Override
                public void actionPerformed(java.awt.event.ActionEvent e) {
                    NodeSelectDialog nsd =
                            new NodeSelectDialog(View.getSingleton().getMainFrame());
                    SiteNode node = null;
                    try {
                        node =
                                Model.getSingleton()
                                        .getSession()
                                        .getSiteTree()
                                        .findNode(new URI(getUrlField().getText(), false));
                    } catch (Exception e2) {
                        // Ignore
                    }
                    node = nsd.showDialog(node);
                    if (node != null && node.getHistoryReference() != null) {
                        try {
                            getUrlField()
                                    .setText(node.getHistoryReference().getURI().toString());
                        } catch (Exception e1) {
                            // Ignore
                        }
                    }
                }
            });

    urlSelectPanel.add(this.getUrlField(), LayoutHelper.getGBC(0, 0, 1, 1.0D));
    urlSelectPanel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D));
    panelContent.add(urlSelectPanel, LayoutHelper.getGBC(1, 0, 3, 0.25D));

    panelContent.add(this.getCheckButton(), LayoutHelper.getGBC(0, 1, 1, 0.0D));

    JPanel outputPanel = new JPanel(new BorderLayout());
    outputPanel.add(
            new JLabel(Constant.messages.getString("tlsdebug.label.console")),
            BorderLayout.NORTH);
    JScrollPane jScrollPane = new JScrollPane();
    jScrollPane.add(getOutputArea(), LayoutHelper.getGBC(0, 0, 4, 1.D, 1.0D)); // Padding
    // at
    // bottom
    jScrollPane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11));
    jScrollPane.setHorizontalScrollBarPolicy(
            javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jScrollPane.setVerticalScrollBarPolicy(
            javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    jScrollPane.setViewportView(getOutputArea());
    outputPanel.add(jScrollPane, BorderLayout.CENTER);

    this.add(outputPanel, BorderLayout.CENTER);
}
 
Example 19
Source File: SyncPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void reinitOperationButton(JButton button, SyncItem.Operation operation) {
    button.setIcon(operation.getIcon(!remotePathFirst));
}
 
Example 20
Source File: MainDialog.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
private JToolBar createToolBar(){
	JToolBar toolBar = new JToolBar();
	// ���ù������Ƿ�����ƶ�
	toolBar.setFloatable(false);
	
	// ���� ���ͼ����Ϣ ��ť
	JButton bookAddButton = new JButton(MenuActions.BOOK_ADD);
	ImageIcon icon = CreateIcon.add("addBook.jpg");
	bookAddButton.setIcon(icon);
	bookAddButton.setHideActionText(true);
	toolBar.add(bookAddButton);
	
	// �ڹ���������� ͼ����Ϣ��ѯ ��ť
	JButton bookButton = new JButton(MenuActions.BOOK_SEARCH);
	ImageIcon bookIcon = CreateIcon.add("bookInfo.jpg");
	bookButton.setIcon(bookIcon);
	bookButton.setHideActionText(true);
	toolBar.add(bookButton);
	
	// �ڹ���������� ͼ�������Ϣ ��ť
	JButton bookBorrowButton = new JButton(MenuActions.BORROW);
	ImageIcon bookBorrowIcon = CreateIcon.add("borrowInfo.jpg");
	bookBorrowButton.setIcon(bookBorrowIcon);
	bookBorrowButton.setHideActionText(true);
	toolBar.add(bookBorrowButton);
	
	// �ڹ������д���������Ӱ�ť
	JButton readerAddButton = new JButton(MenuActions.READER_ADD);
	ImageIcon readerAddIcon = CreateIcon.add("addReader.jpg");
	readerAddButton.setIcon(readerAddIcon);
	readerAddButton.setHideActionText(true);
	toolBar.add(readerAddButton);
	
	// �ڹ������д��������Ӱ�ť
	JButton bsAddButton = new JButton(MenuActions.BS_ADD);
	ImageIcon ReaderSearchIcon = CreateIcon.add("addLibrary.jpg");
	bsAddButton.setIcon(ReaderSearchIcon);
	bsAddButton.setHideActionText(true);
	toolBar.add(bsAddButton);
	
	// �ڹ������и�����˳���ť
	JButton ExitButton = new JButton(MenuActions.EXIT);
	ImageIcon ExitIcon = CreateIcon.add("exit.jpg");
	ExitButton.setIcon(ExitIcon);
	ExitButton.setHideActionText(true);
	toolBar.add(ExitButton);
	
	return toolBar;
}