Java Code Examples for javax.swing.border.BevelBorder

The following examples show how to use javax.swing.border.BevelBorder. These examples are extracted from open source projects. 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 Project: collect-earth   Source File: PropertiesDialog.java    License: MIT License 6 votes vote down vote up
private JPanel getSqlLitePanel() {
	final JPanel panel = new JPanel(new GridBagLayout());
	final GridBagConstraints constraints = new GridBagConstraints();
	constraints.gridx = 0;
	constraints.gridy = 0;
	constraints.anchor = GridBagConstraints.LINE_START;
	constraints.insets = new Insets(5, 5, 5, 5);
	constraints.weightx = 1.0;
	constraints.fill = GridBagConstraints.HORIZONTAL;

	final Border border = new TitledBorder(new BevelBorder(BevelBorder.RAISED),
			Messages.getString("OptionWizard.30")); //$NON-NLS-1$
	panel.setBorder(border);

	panel.add(propertyToComponent.get(EarthProperty.AUTOMATIC_BACKUP)[0], constraints);
	constraints.gridx++;
	panel.add(getOpenBackupFolderButton());
	return panel;
}
 
Example 2
Source Project: visualvm   Source File: BorderBuilders.java    License: GNU General Public License v2.0 6 votes vote down vote up
static BorderBuilder fromField(Instance instance, String field, boolean uiresource, Heap heap) {
    Object _border = instance.getValueOfField(field);
    if (!(_border instanceof Instance)) return null;

    Instance border = (Instance)_border;

    // Make sure subclasses are listed before base class if using isSubclassOf
    if (DetailsUtils.isSubclassOf(border, BevelBorder.class.getName())) {
        return new BevelBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, MatteBorder.class.getName())) { // Must be before EmptyBorder (extends EmptyBorder)
        return new EmptyBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, EmptyBorder.class.getName())) {
        return new MatteBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, EtchedBorder.class.getName())) {
        return new EtchedBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, LineBorder.class.getName())) {
        return new LineBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, TitledBorder.class.getName())) {
        return new TitledBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, CompoundBorder.class.getName())) {
        return new CompoundBorderBuilder(border, heap);
    }

    return null;
}
 
Example 3
Source Project: ghidra   Source File: ProgramTreePlugin.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Method called when the "Open Tree View" icon is hit; creates a window
 * relative to the event source (in this case, a button) and shows the list
 * of trees currently in the Program.
 */
private void openView(Object sourceObject) {
	JButton button = sourceObject instanceof JButton ? (JButton) sourceObject : null;
	final String[] treeNames = currentProgram.getListing().getTreeNames();
	popup = new JPopupMenu("Tree Views");
	for (int i = 0; i < treeNames.length; i++) {
		JMenuItem item = new JMenuItem(treeNames[i]);
		final int index = i;
		item.addActionListener(ev -> openView(treeNames[index]));
		popup.add(item);
	}

	if (treeNames.length == 0) {
		// should not get into this state...
		getTool().setStatusInfo("No views exist.");
	}
	else {
		popup.setBorder(new BevelBorder(BevelBorder.RAISED));
		if (button != null) {
			popup.show(button, button.getX() - button.getWidth(), button.getY());
		}
	}
}
 
Example 4
Source Project: stendhal   Source File: StyleFactory.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
Style create() {
	Color highlight = new Color(50, 50, 50); // Dark Grey (also text shadow)
	Color shadow = new Color(175, 175, 175); // Light rey (also inactive text color)
	PixmapStyle style = new PixmapStyle("data/gui/paneldrock048.jpg",
			false, highlight, shadow, Color.white, Color.white);
	Color bhighout = new Color(130, 130, 130);
	Color bhighin = new Color(100, 100, 100);
	Color bshadow = new Color(20, 20, 20);

	style.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
			bhighout, bhighin, highlight, bshadow));
	style.setBorderDown(BorderFactory.createBevelBorder(BevelBorder.LOWERED,
			bhighout, bhighin, highlight, bshadow));
	return style;
}
 
Example 5
Source Project: netbeans   Source File: ToggleProfilingPointAction.java    License: Apache License 2.0 6 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());

    previewPanel = new JPanel(new FlowLayout(0, 0, FlowLayout.LEADING));
    previewPanel.setBorder(BorderFactory.createEmptyBorder(4, 7, 2, 7));

    label = new JLabel();
    label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 7, 7, 7),
                                                       new ThinBevelBorder(BevelBorder.LOWERED)));
    label.setBorder(BorderFactory.createCompoundBorder(label.getBorder(), BorderFactory.createEmptyBorder(4, 3, 4, 3)));
    label.setFont(label.getFont().deriveFont(Font.BOLD));

    JPanel p = new JPanel(new BorderLayout());
    p.setBorder(BorderFactory.createRaisedBevelBorder());
    p.add(previewPanel, BorderLayout.NORTH);
    p.add(label, BorderLayout.CENTER);

    add(p, BorderLayout.CENTER);
}
 
Example 6
Source Project: netbeans   Source File: BorderBuilders.java    License: Apache License 2.0 6 votes vote down vote up
static BorderBuilder fromField(Instance instance, String field, boolean uiresource, Heap heap) {
    Object _border = instance.getValueOfField(field);
    if (!(_border instanceof Instance)) return null;

    Instance border = (Instance)_border;

    // Make sure subclasses are listed before base class if using isSubclassOf
    if (DetailsUtils.isSubclassOf(border, BevelBorder.class.getName())) {
        return new BevelBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, MatteBorder.class.getName())) { // Must be before EmptyBorder (extends EmptyBorder)
        return new EmptyBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, EmptyBorder.class.getName())) {
        return new MatteBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, EtchedBorder.class.getName())) {
        return new EtchedBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, LineBorder.class.getName())) {
        return new LineBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, TitledBorder.class.getName())) {
        return new TitledBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, CompoundBorder.class.getName())) {
        return new CompoundBorderBuilder(border, heap);
    }

    return null;
}
 
Example 7
Source Project: consulo   Source File: CommanderPanel.java    License: Apache License 2.0 6 votes vote down vote up
public final void setActive(final boolean active) {
  myActive = active;
  if (active) {
    myTitlePanel.setBackground(DARK_BLUE);
    myTitlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, DARK_BLUE_BRIGHTER, DARK_BLUE_DARKER));
    myParentTitle.setForeground(Color.white);
  }
  else {
    final Color color = UIUtil.getPanelBackground();
    LOG.assertTrue(color != null);
    myTitlePanel.setBackground(color);
    myTitlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, color.brighter(), color.darker()));
    myParentTitle.setForeground(JBColor.foreground());
  }
  final int[] selectedIndices = myList.getSelectedIndices();
  if (selectedIndices.length == 0 && myList.getModel().getSize() > 0) {
    myList.setSelectedIndex(0);
    if (!myList.hasFocus()) {
      IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(myList);
    }
  }
  else if (myList.getModel().getSize() > 0) {
    // need this to generate SelectionChanged events so that listeners, added by Commander, will be notified
    myList.setSelectedIndices(selectedIndices);
  }
}
 
Example 8
Source Project: stendhal   Source File: StyleFactory.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
Style create() {
	// Text
	Color highlight = new Color(219, 191, 130);
	Color shadow = new Color(36, 14, 0); // Light brown (also inactive text)
	PixmapStyle style = new PixmapStyle("data/gui/panel_brick_brown_001.png",
			false, highlight, shadow, Color.white, Color.white);
	// Border
	Color blightin = new Color(181, 140, 50);
	Color bshadowin = new Color(98, 47, 15);
	style.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
			highlight, blightin, shadow, bshadowin));
	style.setBorderDown(BorderFactory.createBevelBorder(BevelBorder.LOWERED,
			highlight, blightin, shadow, bshadowin));
	return style;
}
 
Example 9
/**
 * Returns the rendered header cell for the supplied value and column.
 *
 * @param jtRevokedCerts The JTable
 * @param value The value to assign to the cell
 * @param bIsSelected True if cell is selected
 * @param iRow The row of the cell to render
 * @param iCol The column of the cell to render
 * @param bHasFocus If true, render cell appropriately
 * @return The rendered cell
 */
@Override
public Component getTableCellRendererComponent(JTable jtRevokedCerts, Object value, boolean bIsSelected,
    boolean bHasFocus, int iRow, int iCol)
{
	// Get header renderer
	JLabel header = (JLabel) jtRevokedCerts.getColumnModel().getColumn(iCol).getHeaderRenderer();

	// The headers contain text
	header.setText(value.toString());
	header.setHorizontalAlignment(LEFT);

	// Set tool tips
	if (iCol == 0)
	{
		header.setToolTipText(RB.getString("RevokedCertsTableHeadRend.SerialNumberColumn.tooltip"));
	}
	else
	{
		header.setToolTipText(RB.getString("RevokedCertsTableHeadRend.RevocationDateColumn.tooltip"));
	}

	header.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.RAISED), new EmptyBorder(0, 5, 0, 5)));

	return header;
}
 
Example 10
Source Project: Hospital-Management-System   Source File: testtable.java    License: MIT License 6 votes vote down vote up
private void initializeUI() {
    setSize(400, 400);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout(15, 15));

    JPanel top = new JPanel();
    top.setBorder(new LineBorder(Color.RED, 1, true));

    JPanel bottom = new JPanel();
    bottom.setBorder(new BevelBorder(BevelBorder.LOWERED));

    JPanel left = new JPanel();
    left.setBorder(new EtchedBorder(EtchedBorder.RAISED));

    JPanel right = new JPanel();
    right.setBorder(new MatteBorder(5, 5, 5, 5, Color.BLUE));

    JPanel center = new JPanel();
    center.setBorder(new BevelBorder(BevelBorder.RAISED));

    getContentPane().add(top, BorderLayout.NORTH);
    getContentPane().add(bottom, BorderLayout.SOUTH);
    getContentPane().add(left, BorderLayout.WEST);
    getContentPane().add(right, BorderLayout.EAST);
    getContentPane().add(center, BorderLayout.CENTER);
}
 
Example 11
/**
 * Returns the rendered header cell for the supplied value and column.
 *
 * @param jtSystemProperties The JTable
 * @param value The value to assign to the cell
 * @param bIsSelected True if cell is selected
 * @param iRow The row of the cell to render
 * @param iCol The column of the cell to render
 * @param bHasFocus If true, render cell appropriately
 * @return The rendered cell
 */
@Override
public Component getTableCellRendererComponent(JTable jtSystemProperties, Object value, boolean bIsSelected,
    boolean bHasFocus, int iRow, int iCol)
{
	// Get header renderer
	JLabel header = (JLabel) jtSystemProperties.getColumnModel().getColumn(iCol).getHeaderRenderer();

	// The headers contain left-aligned text
	header.setText(value.toString());
	header.setHorizontalAlignment(LEFT);

	header.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.RAISED), new EmptyBorder(0, 5, 0, 5)));

	return header;
}
 
Example 12
Source Project: stendhal   Source File: StyleFactory.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
Style create() {
	// Font
	Color foreground = new Color(42, 18, 0); // Brown
	Color highlight = new Color(142, 90, 0); // Light brown (also text shadow)
	PixmapStyle style = new PixmapStyle("data/gui/panel_honeycomb_001.png",
			false, highlight, Color.white, Color.white, foreground);

	// Border
	Color blightout = new Color(255, 255, 180);
	Color blightin = new Color(202, 202, 101);
	Color bshadowin = new Color(160, 128, 32);
	Color bshadowout = new Color(86, 69, 17);
	style.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
			blightout, blightin, bshadowout, bshadowin));
	style.setBorderDown(BorderFactory.createBevelBorder(BevelBorder.LOWERED,
			blightout, blightin, bshadowin, bshadowout));
	return style;
}
 
Example 13
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 6 votes vote down vote up
private MainPanel() {
  super(new BorderLayout());
  JButton button1 = makeButton("Default BevelBorder", new BevelBorder(BevelBorder.RAISED) {
    @Override public Insets getBorderInsets(Component c, Insets insets) {
      insets.set(10, 10, 10, 10);
      return insets;
    }
  });
  JButton button2 = makeButton("Custom BevelBorder", new CustomBevelBorder(BevelBorder.RAISED));

  JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 20));
  p.setBorder(BorderFactory.createEmptyBorder(20, 50, 20, 50));
  p.add(button1);
  p.add(button2);

  add(p);
  EventQueue.invokeLater(() -> SwingUtilities.updateComponentTreeUI(p));
  setPreferredSize(new Dimension(320, 240));
}
 
Example 14
ThreadHeaderRenderer(int modelCol) {
  super(modelCol);

  sort = new JPanel(new BorderLayout());
  sort.setBorder(new BevelBorder(BevelBorder.RAISED));
  sort.add(new JLabel(threadSortIcon), BorderLayout.CENTER);

  unsort = new JPanel(new BorderLayout());
  unsort.setBorder(new BevelBorder(BevelBorder.RAISED));
  unsort.add(new JLabel(threadUnSortIcon), BorderLayout.CENTER);

  comp = unsort;
}
 
Example 15
Source Project: Cafebabe   Source File: OuterSplitPane.java    License: GNU General Public License v3.0 5 votes vote down vote up
public OuterSplitPane(Component left, Component right) {
	super(JSplitPane.HORIZONTAL_SPLIT, left, right);

	this.setBorder(new BevelBorder(BevelBorder.LOWERED));
	this.setPreferredSize(new Dimension(this.getWidth(), 24));
	this.setDividerLocation((int) (Cafebabe.gui.getSize().getWidth() / 3.5));
}
 
Example 16
Source Project: ghidra   Source File: DefaultGTreeFilterProvider.java    License: Apache License 2.0 5 votes vote down vote up
private JPanel createFilterPanel() {
	JPanel newFilterPanel = new JPanel(new BorderLayout());
	newFilterPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
	JLabel filterLabel = new GLabel(" Filter: ");
	newFilterPanel.add(filterLabel, BorderLayout.WEST);

	filterField = new FilterTextField(gTree.getJTree());
	newFilterPanel.add(filterField, BorderLayout.CENTER);
	filterField.addFilterListener(filterListener);

	filterStateButton = new EmptyBorderButton(filterFactory.getFilterStateIcon());
	filterStateButton.addActionListener(e -> {
		FilterOptionsEditorDialog dialog =
			new FilterOptionsEditorDialog(filterFactory.getFilterOptions());
		DockingWindowManager.showDialog(filterPanel, dialog);
		FilterOptions newFilterOptions = dialog.getResultFilterOptions();
		if (newFilterOptions != null) {
			filterFactory = new GTreeFilterFactory(newFilterOptions);

			filterStateButton.setIcon(newFilterOptions.getFilterStateIcon());
			filterStateButton.setToolTipText(newFilterOptions.getFilterDescription());

			saveFilterState();
			updateModelFilter();
		}
	});

	HelpService helpService = DockingWindowManager.getHelpService();
	HelpLocation helpLocation = new HelpLocation("Trees", "Filters");
	helpService.registerHelp(filterStateButton, helpLocation);
	helpService.registerHelp(filterLabel, helpLocation);
	helpService.registerHelp(filterField, helpLocation);

	filterStateButton.setToolTipText("Filter Options");
	newFilterPanel.add(filterStateButton, BorderLayout.EAST);
	return newFilterPanel;
}
 
Example 17
Source Project: ghidra   Source File: DropDownTextField.java    License: Apache License 2.0 5 votes vote down vote up
private void createMatchingWindow() {
	Window parentWindow = WindowUtilities.windowForComponent(this);

	if (parentWindow == null) {
		// maybe we are in a transition phase?
		return;
	}

	// We need to know when to change the size and location of our window.  We call remove
	// first, in case we've already added the listener before
	parentWindow.removeComponentListener(parentWindowListener);
	parentWindow.addComponentListener(parentWindowListener);

	matchingWindow = new JWindow(parentWindow);
	matchingWindow.setFocusable(false);
	JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBorder(
		BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.GRAY, Color.BLACK));
	scrollPane.setFocusable(false);
	scrollPane.getVerticalScrollBar().setFocusable(false);
	scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	scrollPane.getViewport().add(list);

	matchingWindow.getContentPane().add(scrollPane);
	matchingWindow.setSize(MIN_WIDTH, matchingWindowHeight);

	addUpdateListeners();

	createToolTipWindow(parentWindow);
}
 
Example 18
Source Project: ghidra   Source File: SplashScreen.java    License: Apache License 2.0 5 votes vote down vote up
private Component createContentPanel() {
	JPanel contentPanel = new JPanel(new BorderLayout());
	contentPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
	contentPanel.add(createInfoComponent(), BorderLayout.CENTER);
	contentPanel.add(createStatusComponent(), BorderLayout.SOUTH);
	return contentPanel;
}
 
Example 19
Source Project: ghidra   Source File: LengthFilter.java    License: Apache License 2.0 5 votes vote down vote up
private JComponent createComponent() {
	final JLabel label = new GDLabel("Length Filter: ");

	Integer defaultValue = DEFAULT_FILTER_VALUE;
	textField = new FilterFormattedTextField(new IntegerFormatterFactory(false), defaultValue);
	textField.setName("Length Filter Field"); // for debugging
	textField.setInputVerifier(new IntegerInputVerifier());
	textField.setHorizontalAlignment(SwingConstants.RIGHT);

	textField.setColumns(5);

	final JPanel panel = new JPanel(new BorderLayout());
	Border paddingBorder = BorderFactory.createEmptyBorder(1, 5, 1, 5);
	Border outsideBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
	panel.setBorder(BorderFactory.createCompoundBorder(outsideBorder, paddingBorder));

	panel.add(label, BorderLayout.WEST);
	panel.add(textField, BorderLayout.EAST);

	final JLayeredPane layeredPane = new JLayeredPane();

	StatusLabel statusLabel = new StatusLabel(textField, defaultValue);
	textField.addFilterStatusListener(statusLabel);
	textField.addFilterStatusListener(status -> fireStatusChanged(status));
	layeredPane.add(panel, BASE_COMPONENT_LAYER);
	layeredPane.add(statusLabel, HOVER_COMPONENT_LAYER);
	layeredPane.setPreferredSize(panel.getPreferredSize());
	layeredPane.addComponentListener(new ComponentAdapter() {
		@Override
		public void componentResized(java.awt.event.ComponentEvent e) {
			Dimension preferredSize = panel.getPreferredSize();
			panel.setBounds(0, 0, preferredSize.width, preferredSize.height);
			panel.validate();
		}
	});

	return layeredPane;
}
 
Example 20
Source Project: ghidra   Source File: AddressInputDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Component getTableCellEditorComponent(JTable theTable, Object value, boolean isSelected,
		int row, int column) {

	this.table = theTable;
	EditableAddress editableAddress = (EditableAddress) value;
	address = editableAddress.getAddress();

	JLabel label = new GDLabel();
	label.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
	label.setText(editableAddress.getDisplayString());

	VTMarkupItem markupItem = editableAddress.getMarkupItem();
	VTMarkupItemDestinationAddressEditStatus status =
		markupItem.getDestinationAddressEditStatus();
	if (status != VTMarkupItemDestinationAddressEditStatus.EDITABLE) {
		final String description = status.getDescription();
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				fireEditingCanceled();
				Msg.showInfo(getClass(), table, "Cannot Edit Destination Address", description);
			}
		});
		return label;
	}

	dialog = new DialogProvider(editableAddress);
	dialog.setRememberSize(false);
	SwingUtilities.invokeLater(new Runnable() {
		@Override
		public void run() {
			controller.getTool().showDialog(dialog, label);
			stopCellEditing();
		}
	});

	return label;
}
 
Example 21
Source Project: ghidra   Source File: AbstractTextFilter.java    License: Apache License 2.0 5 votes vote down vote up
private JComponent createComponent(String filterName) {
	final JPanel panel = new JPanel(new BorderLayout());
	Border paddingBorder = BorderFactory.createEmptyBorder(1, 5, 1, 5);
	Border outsideBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
	panel.setBorder(BorderFactory.createCompoundBorder(outsideBorder, paddingBorder));

	DefaultFormatterFactory factory = new DefaultFormatterFactory(new DefaultFormatter());
	textField = new FilterFormattedTextField(factory, defaultValue);
	textField.setName(filterName + " Field"); // for debugging 	
	textField.setColumns(20);
	textField.setMinimumSize(textField.getPreferredSize());

	// we handle updates in real time, so ignore focus events, which trigger excess filtering
	textField.disableFocusEventProcessing();

	JLabel label = new GDLabel(filterName + ": ");
	panel.add(label, BorderLayout.WEST);
	panel.add(textField, BorderLayout.CENTER);

	StatusLabel nameFieldStatusLabel = new StatusLabel(textField, defaultValue);
	textField.addFilterStatusListener(nameFieldStatusLabel);
	textField.addFilterStatusListener(status -> fireStatusChanged(status));

	final JLayeredPane layeredPane = new JLayeredPane();
	layeredPane.add(panel, BASE_COMPONENT_LAYER);
	layeredPane.add(nameFieldStatusLabel, HOVER_COMPONENT_LAYER);

	layeredPane.setPreferredSize(panel.getPreferredSize());
	layeredPane.addComponentListener(new ComponentAdapter() {
		@Override
		public void componentResized(java.awt.event.ComponentEvent e) {
			Dimension preferredSize = layeredPane.getSize();
			panel.setBounds(0, 0, preferredSize.width, preferredSize.height);
			panel.validate();
		}
	});

	return layeredPane;
}
 
Example 22
Source Project: Darcula   Source File: ProgressBarDemo.java    License: Apache License 2.0 5 votes vote down vote up
private void createProgressPanel() {
    setLayout(new BorderLayout());

    JPanel textWrapper = new JPanel(new BorderLayout());
    textWrapper.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
    textWrapper.setAlignmentX(LEFT_ALIGNMENT);
    progressTextArea = new MyTextArea();

    progressTextArea.getAccessibleContext().setAccessibleName(
            resourceManager.getString("ProgressBarDemo.accessible_text_area_name"));
    progressTextArea.getAccessibleContext().setAccessibleName(
            resourceManager.getString("ProgressBarDemo.accessible_text_area_description"));
    textWrapper.add(new JScrollPane(progressTextArea), BorderLayout.CENTER);

    add(textWrapper, BorderLayout.CENTER);

    JPanel progressPanel = new JPanel();
    add(progressPanel, BorderLayout.SOUTH);

    progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, text.length()) {
        public Dimension getPreferredSize() {
            return new Dimension(300, super.getPreferredSize().height);
        }
    };
    progressBar.getAccessibleContext().setAccessibleName(
            resourceManager.getString("ProgressBarDemo.accessible_text_loading_progress"));

    progressPanel.add(progressBar);
    progressPanel.add(createLoadButton());
    progressPanel.add(createStopButton());
}
 
Example 23
private void updateBorderImage() {
    if(useAFile.isSelected()) {
        borderImage.setBorder(null);
        return;
    }
    Border res;
    borderImage.setIcon(null);
    switch(borderType.getSelectedIndex()) {
        case 1: // Line
            res = new LineBorder(getColor(colorA), ((Number)thickness.getValue()).intValue(), true);
            break;
        case 2: // Raised Etched
            res = BorderFactory.createEtchedBorder(EtchedBorder.RAISED, getColor(colorA), getColor(colorB));
            break;
        case 3: // Lowered Etched
            res = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, getColor(colorA), getColor(colorB));
            break;
        case 4: // Raised Bevel
            res = BorderFactory.createBevelBorder(BevelBorder.RAISED, getColor(colorA), getColor(colorB), getColor(colorC), getColor(colorD));
            break;
        case 5: // Lowered Bevel
            res = BorderFactory.createBevelBorder(BevelBorder.LOWERED, getColor(colorA), getColor(colorB), getColor(colorC), getColor(colorD));
            break;
        default: // Round
            res = new RoundedBorder();
            break;
    }
    Color c = getColor(colorC);
    borderImage.setBackground(new Color(c.getRed(), c.getGreen(), c.getBlue(), ((Number)opacity.getValue()).intValue()));
    borderImage.setPreferredSize(new Dimension(((Number)width.getValue()).intValue(),
            ((Number)height.getValue()).intValue()));
    borderImage.setBorder(res);
    borderImage.revalidate();
    borderImage.repaint();
}
 
Example 24
/**
 * Build the logging panel.
 */
private void buildLogPane() {
  // logging panel
  logTextArea.setFont(new Font("MonoSpaced", Font.PLAIN, 10));
  logTextArea.setEditable(false);
  logTextArea.setCaretPosition(logTextArea.getDocument().getLength());
  logTextPane.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
  logTextPane.setAutoscrolls(true);
  log(Level.INFO, "running GrammarViz 3.0 demo");
}
 
Example 25
Source Project: netbeans   Source File: BevelBorderBeanInfo.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected PropertyDescriptor[] createPropertyDescriptors() throws IntrospectionException {
    PropertyDescriptor[] pds = new PropertyDescriptor[] {
        createRO(BevelBorder.class, "bevelType"), // NOI18N
        createRO(BevelBorder.class, "highlightOuterColor"), // NOI18N
        createRO(BevelBorder.class, "highlightInnerColor"), // NOI18N
        createRO(BevelBorder.class, "shadowOuterColor"), // NOI18N
        createRO(BevelBorder.class, "shadowInnerColor"), // NOI18N
    };
    pds[0].setPropertyEditorClass(BevelTypePropertyEditor.class);
    return pds;
}
 
Example 26
Source Project: netbeans   Source File: PatternSandbox.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Initialize UI components.
 */
protected void initComponents() {

    cboxPattern = new JComboBox<String>();
    cboxPattern.setEditable(true);
    cboxPattern.setRenderer(new ShorteningCellRenderer());
    lblPattern = new JLabel();
    lblPattern.setLabelFor(cboxPattern);
    lblHint = new JLabel();
    lblHint.setEnabled(false);
    lblOptions = new JLabel();
    textPane = new JTextPane();
    textScrollPane = new JScrollPane();
    textScrollPane.setViewportView(textPane);
    textScrollPane.setPreferredSize(new Dimension(350, 100));
    textScrollPane.setBorder(new BevelBorder(BevelBorder.LOWERED));
    searchCriteria = new BasicSearchCriteria();
    initSpecificComponents();
    pnlOptions = createOptionsPanel();
    btnApply = new JButton();
    btnCancel = new JButton();
    cboxPatternForegroundStd = cboxPattern.getEditor().getEditorComponent().
            getForeground();

    initTextPaneContent();
    initHighlighter();

    setMnemonics();
    layoutComponents();
    initInteraction();
    this.addHierarchyListener(this);
    highlightMatchesLater();
}
 
Example 27
Source Project: netbeans   Source File: SwingBorderGetterTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testGetter () {
    Scene scene = new Scene ();
    BevelBorder originalBorder = new BevelBorder (BevelBorder.RAISED);
    scene.setBorder (originalBorder);
    Border foundBorder = BorderSupport.getSwingBorder (scene.getBorder ());
    assertEquals (originalBorder, foundBorder);
}
 
Example 28
Source Project: netbeans   Source File: RendererFactory.java    License: Apache License 2.0 5 votes vote down vote up
private void delegatedPaint(Graphics g) {
    Color c = g.getColor();

    try {
        g.setColor(getBackground());
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(getForeground());

        if (!tableUI) {
            //in the panel, give self-painting editors a lowered
            //border so they look like something
            Border b = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
            b.paintBorder(this, g, 0, 0, getWidth(), getHeight());
        }

        Rectangle r = getBounds();

        //XXX May be the source of Rochelle's multiple rows of error 
        //marking misalignment problem...(I do not jest)
        r.x = (getWidth() > 16) ? ((editor instanceof Boolean3WayEditor) ? 0 : 3) : 0; //align text with other renderers
        r.width -= ((getWidth() > 16) ? ((editor instanceof Boolean3WayEditor) ? 0 : 3) : 0); //align text with other renderers
        r.y = 0;
        editor.paintValue(g, r);
    } finally {
        g.setColor(c);
    }
}
 
Example 29
private void setType() {
    int locationPoint = 323;
    for (int i = 0; i < 3; i++) {

        roomTypes = new JTextField();
        roomTypes.setColumns(10);
        roomTypes.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
        roomTypes.setBounds(locationPoint, 97, 86, 20);
        roomTypes.setVisible(false);
        bottomPanel.add(roomTypes);

        roomTypeFields[i] = roomTypes;
        locationPoint = locationPoint + 96;
    }
}
 
Example 30
/**
 * Create the frame.
 */
public LicenseWindow(final String path) {
	
	setTitle("Coder HPMSA - [License]");
	setBounds(100, 100, 550, 550);
	setBackground(Color.decode("#066d95"));
	setLocationRelativeTo(null);
	setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	
	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));
	
	final JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	getContentPane().add(scrollPane, BorderLayout.CENTER);
	
	editorPane = new JTextPane();
	editorPane.setBackground(new Color(255, 255, 240));
	editorPane.setFont(new Font("Verdana", Font.PLAIN, 13));
	editorPane.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
	editorPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	editorPane.setEditable(false);
	scrollPane.setViewportView(editorPane);
	
	final StyledDocument doc = editorPane.getStyledDocument();
	final SimpleAttributeSet center = new SimpleAttributeSet();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	doc.setParagraphAttributes(0, doc.getLength()-1, center, false);
	
	fillEditorPane(path);
	setVisible(true);
}