Java Code Examples for javax.swing.border.EtchedBorder

The following examples show how to use javax.swing.border.EtchedBorder. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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 2
/**
 * Icon button which has only icon
 * @param notPressedImage Icon16x16
 * @param pressedImage Icon16x16
 * @param border Boolean
 * @param actionCommand String
 * @param parent Component
 */
public IconButton(final Icon16x16 notPressedImage,
    final Icon16x16 pressedImage, final boolean border,
    final String actionCommand, final Component parent) {
  super();
  ImageIcon icon = new ImageIcon(notPressedImage.getIcon(), "");
  this.setIcon(icon);
  this.setDisabledIcon(icon);
  this.setNotPressedImage(notPressedImage.getIcon());
  this.setPressedImage(pressedImage.getIcon());
  this.setActionCommand(actionCommand);
  this.setBorder(border);
  this.parent = parent;
  this.setBackground(GuiStatics.COLOR_SPACE_GREY_BLUE);
  if (border) {
    this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
  } else {
    this.setBorder(BorderFactory.createEmptyBorder());

  }
}
 
Example 3
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 4
Source Project: saros   Source File: TextAreaPage.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void create() {
  setLayout(new BorderLayout());

  JPanel middlePanel = new JPanel();
  middlePanel.setBorder(new TitledBorder(new EtchedBorder(), title));

  display = new JTextArea(10, 48);
  display.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
  display.setEditable(false);
  display.setForeground(fontColor);

  JScrollPane scroll = new JBScrollPane(display);
  scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  middlePanel.add(scroll);

  add(middlePanel, BorderLayout.CENTER);

  JPanel progressPanel = new JPanel();
  progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
}
 
Example 5
Source Project: netbeans   Source File: PortChooser.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates new form PortChooser */
public PortChooser(Node root) {
    initComponents();

    this.nodeAcceptor = new NodeAcceptorImpl();

    nodeDisplayPanel = new NodeDisplayPanel(root);
    nodeDisplayPanel.setBorder(new EtchedBorder());
    jPanelBeanTree.add(nodeDisplayPanel);
    nodeDisplayPanel.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent pce) {
            validateNodes();
        }
    });
    
    BeanTreeView btw = (BeanTreeView)nodeDisplayPanel.getComponent(0);
    jLabelDesc.setLabelFor(btw.getViewport().getView());
    
    validateNodes();
}
 
Example 6
Source Project: netbeans   Source File: JaxWsExplorerPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void initUserComponents() {
    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    treeView.setPopupAllowed(false);
    treeView.setBorder(new EtchedBorder());
    
    java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(11, 11, 0, 11);
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(treeView, gridBagConstraints);
    jLblTreeView.setLabelFor(treeView.getViewport().getView());
    treeView.getAccessibleContext().setAccessibleName(NbBundle.getMessage(JaxWsExplorerPanel.class, "ACSD_WebServicesTreeView"));
    treeView.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(JaxWsExplorerPanel.class, "ACSD_WebServicesTreeView"));
}
 
Example 7
/**
 * Construct an ImageLabel.
 * @param image Image to show
 * @param border Boolean is there a border or not
 */
public ImageLabel(final BufferedImage image, final boolean border) {
  super();
  ImageIcon icon = new ImageIcon(image, "");
  this.setIcon(icon);
  this.setImage(image);
  this.setBorder(border);
  this.setFillColor(null);
  if (isBorder()) {
    this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
  } else {
    this.setBorder(BorderFactory.createEmptyBorder());

  }

}
 
Example 8
Source Project: hush-swing-wallet-ui   Source File: AddressBookPanel.java    License: MIT License 6 votes vote down vote up
private JPanel buildButtonsPanel(
        final JButton newContactButton,
        final JButton sendCashButton,
        final JButton copyToClipboardButton,
        final JButton deleteContactButton
) {
    final JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 3, 3));

    panel.add(newContactButton);
    panel.add(sendCashButton);
    panel.add(copyToClipboardButton);
    panel.add(deleteContactButton);

    return panel;
}
 
Example 9
Source Project: gate-core   Source File: Splash.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Constructor from owner, GraphicsConfiguration and content.
 */
public Splash(Window owner, GraphicsConfiguration gc, final JComponent content) {
  super(owner, "About...", ModalityType.APPLICATION_MODAL, gc);
  getContentPane().setLayout(new BorderLayout());
  content.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
  getContentPane().add(content, BorderLayout.CENTER);
  content.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      // when the content pane is clicked, hide it
      setVisible(false);
    }
  });
  validate();
  pack();
}
 
Example 10
Source Project: zencash-swing-wallet-ui   Source File: AddressBookPanel.java    License: MIT License 6 votes vote down vote up
private JPanel buildButtonsPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 3, 3));
    
    JButton newContactButton = new JButton(langUtil.getString("panel.address.book.new.contact.button.text"));
    newContactButton.addActionListener(new NewContactActionListener());
    panel.add(newContactButton);
            
    sendCashButton = new JButton(langUtil.getString("panel.address.book.send.zen.button.text"));
    sendCashButton.addActionListener(new SendCashActionListener());
    sendCashButton.setEnabled(false);
    panel.add(sendCashButton);
    
    copyToClipboardButton = new JButton(langUtil.getString("panel.address.book.copy.clipboard.button.text"));
    copyToClipboardButton.setEnabled(false);
    copyToClipboardButton.addActionListener(new CopyToClipboardActionListener());
    panel.add(copyToClipboardButton);
    
    deleteContactButton = new JButton(langUtil.getString("panel.address.book.delete.contact.button.text"));
    deleteContactButton.setEnabled(false);
    deleteContactButton.addActionListener(new DeleteAddressActionListener());
    panel.add(deleteContactButton);
    
    return panel;
}
 
Example 11
protected void makeUI() {
  setLayout(new BorderLayout());

  JPanel statusPanel = new JPanel(new BorderLayout());
  statusPanel.setBorder(new EtchedBorder());
  JLabel positionLabel = new JLabel("position");
  statusPanel.add(positionLabel, BorderLayout.CENTER);

  np.setPositionLabel(positionLabel);
  add(toolPanel, BorderLayout.NORTH);
  add(np, BorderLayout.CENTER);
  add(statusPanel, BorderLayout.SOUTH);
}
 
Example 12
Source Project: openAGV   Source File: OpenTCSView.java    License: Apache License 2.0 5 votes vote down vote up
private void configureToolBarButtons(JToolBar bar) {
  final Dimension dimButton = new Dimension(32, 34);
  for (Component comp : bar.getComponents()) {
    if (comp instanceof JButton || comp instanceof JToggleButton) {
      JComponent tbButton = (JComponent) comp;
      tbButton.setMaximumSize(dimButton);
      tbButton.setPreferredSize(dimButton);
      tbButton.setBorder(new EtchedBorder());
    }
  }
}
 
Example 13
public PolicyZipDropTarget() {
	policyZipAccepted = false;
	ImageIcon icon = new ImageIcon(getClass().getResource("images/drag_policy_here.png"));
	setIcon(icon);
	setBorder(new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5)));
	setOpaque(true);
	setBackground(Color.WHITE);

	// Make this label a drop target and its own listener
	new DropTarget(this, this);
}
 
Example 14
public MemoryMonitor() {
    setLayout(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
    add(surf = new Surface());
    controls = new JPanel();
    controls.setPreferredSize(new Dimension(135,80));
    Font font = new Font("serif", Font.PLAIN, 10);
    JLabel label = new JLabel("Sample Rate");
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(label);
    tf = new JTextField("1000");
    tf.setPreferredSize(new Dimension(45,20));
    controls.add(tf);
    controls.add(label = new JLabel("ms"));
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(dateStampCB);
    dateStampCB.setFont(font);
    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
           removeAll();
           if ((doControls = !doControls)) {
               surf.stop();
               add(controls);
           } else {
               try {
                   surf.sleepAmount = Long.parseLong(tf.getText().trim());
               } catch (Exception ex) {}
               surf.start();
               add(surf);
           }
           validate();
           repaint();
        }
    });
}
 
Example 15
Source Project: osrsclient   Source File: HiscoresPanel.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setup() {
       this.setLayout(new MigLayout("ins 5,center"));
       this.setBackground(Color.BLACK);
       usernameField = new JTextField();
       usernameField.setDocument(new LengthRestrictedDocument(12));
       usernameField.setBackground(new Color(101, 101, 101));
       usernameField.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

       xpDisplay = new JLabel();
       rsnLabel = new JLabel("RSN:");
       rsnLabel.setForeground(Color.white);
       rsnLabel.setFont(new Font(rsnLabel.getFont().getFontName(), Font.BOLD, rsnLabel.getFont().getSize()));

       levelsDisplayPanel = new LevelsPanel();
       levelsDisplayPanel.setRolloverListener(this);

       levelInfoPanel = new LevelInfoPanel();

       searchButton = new JButton();
       searchButton.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("resources/searchiconsquare3.png")));
       //searchButton.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("resources/bwsearch2.png")));
searchButton.setBorderPainted(false);
       searchButton.setFocusPainted(false);
       searchButton.setContentAreaFilled(false);

       add(rsnLabel, "cell 0 0, gap 0, align left");
       add(usernameField, "width 60%, cell 1 0,align left, ");
       add(searchButton, "cell 2 0,align right ");
       add(levelsDisplayPanel, "width 100%, height 20%, cell 0 1, center,spanx");
       add(levelInfoPanel, "width 100%, height 15%, cell 0 2, center, spanx");
   }
 
Example 16
Source Project: ghidra   Source File: OptionsEditorPanel.java    License: Apache License 2.0 5 votes vote down vote up
private Component buildOptionGroupPanel(List<Option> optionGroup) {

		JPanel panel = new JPanel(getBestLayout());
		String group = optionGroup.get(0).getGroup();

		panel.setBorder(createBorder(group));
		for (Option option : optionGroup) {
			panel.add(new GLabel(option.getName(), SwingConstants.RIGHT));
			Component editorComponent = getEditorComponent(option);
			editorComponent.setName(option.getName()); // set the component name to the option name
			panel.add(editorComponent);
		}

		if (needsSelectAllDeselectAllButton(optionGroup)) {
			JPanel wrapperPanel = new JPanel(new BorderLayout());
			wrapperPanel.add(panel, BorderLayout.CENTER);
			List<JCheckBox> list = findAllCheckBoxes(panel);
			JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
			buttonPanel.add(buildSelectAll(list));
			buttonPanel.add(buildDeselectAll(list));
			wrapperPanel.add(buttonPanel, BorderLayout.SOUTH);
			Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
			Border marginBorder = BorderFactory.createEmptyBorder(10, 0, 10, 10);
			panel.setBorder(BorderFactory.createCompoundBorder(etchedBorder, marginBorder));
			buttonPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
			return wrapperPanel;
		}

		return panel;
	}
 
Example 17
Source Project: TencentKona-8   Source File: MemoryMonitor.java    License: GNU General Public License v2.0 5 votes vote down vote up
public MemoryMonitor() {
    setLayout(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
    add(surf = new Surface());
    controls = new JPanel();
    controls.setPreferredSize(new Dimension(135,80));
    Font font = new Font("serif", Font.PLAIN, 10);
    JLabel label = new JLabel("Sample Rate");
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(label);
    tf = new JTextField("1000");
    tf.setPreferredSize(new Dimension(45,20));
    controls.add(tf);
    controls.add(label = new JLabel("ms"));
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(dateStampCB);
    dateStampCB.setFont(font);
    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
           removeAll();
           if ((doControls = !doControls)) {
               surf.stop();
               add(controls);
           } else {
               try {
                   surf.sleepAmount = Long.parseLong(tf.getText().trim());
               } catch (Exception ex) {}
               surf.start();
               add(surf);
           }
           validate();
           repaint();
        }
    });
}
 
Example 18
Source Project: GpsPrune   Source File: PointTypeSelector.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor
 */
public PointTypeSelector()
{
	createComponents();
	setBorder(BorderFactory.createCompoundBorder(
		BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(4, 4, 4, 4))
	);
}
 
Example 19
Source Project: jdk8u60   Source File: MemoryMonitor.java    License: GNU General Public License v2.0 5 votes vote down vote up
public MemoryMonitor() {
    setLayout(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
    add(surf = new Surface());
    controls = new JPanel();
    controls.setPreferredSize(new Dimension(135,80));
    Font font = new Font("serif", Font.PLAIN, 10);
    JLabel label = new JLabel("Sample Rate");
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(label);
    tf = new JTextField("1000");
    tf.setPreferredSize(new Dimension(45,20));
    controls.add(tf);
    controls.add(label = new JLabel("ms"));
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(dateStampCB);
    dateStampCB.setFont(font);
    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
           removeAll();
           if ((doControls = !doControls)) {
               surf.stop();
               add(controls);
           } else {
               try {
                   surf.sleepAmount = Long.parseLong(tf.getText().trim());
               } catch (Exception ex) {}
               surf.start();
               add(surf);
           }
           validate();
           repaint();
        }
    });
}
 
Example 20
Source Project: nextreports-designer   Source File: BannerPanel.java    License: Apache License 2.0 5 votes vote down vote up
public BannerPanel() {
    setBorder(new CompoundBorder(new EtchedBorder(), new EmptyBorder(3, 3, 3, 3)));

    setOpaque(true);
    setBackground(UIManager.getColor("Table.background"));

    titleLabel = new JLabel();
    titleLabel.setOpaque(false);

    subtitleLabel = new JEditorPane("text/html", "<html>");
    subtitleLabel.setFont(titleLabel.getFont());

    LookAndFeelTweaks.makeBold(titleLabel);
    LookAndFeelTweaks.makeMultilineLabel(subtitleLabel);
    LookAndFeelTweaks.htmlize(subtitleLabel);

    iconLabel = new JLabel();
    iconLabel.setMinimumSize(new Dimension(50, 50));

    setLayout(new BorderLayout());

    JPanel nestedPane = new JPanel();
    nestedPane.setLayout(new GridBagLayout());
    nestedPane.setOpaque(false);
    nestedPane.add(titleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
            GridBagConstraints.WEST, GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5), 0, 0));
    nestedPane.add(new JLabel(""), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0), 0, 0));        
    nestedPane.add(subtitleLabel, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0,
            GridBagConstraints.WEST, GridBagConstraints.BOTH,
            new Insets(0, 5, 5, 5), 0, 0));

    add(BorderLayout.CENTER, nestedPane);
    add(BorderLayout.EAST, iconLabel);
}
 
Example 21
Source Project: JPPF   Source File: PickList.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@link JList} the list of available items.
 * @param list the list to setup.
 * @param title the list title, may be {@code null}.
 * @param listener a list selection listener.
 * @return the list that was created.
 */
private JComponent setupList(final JList<T> list, final String title, final ListSelectionListener listener) {
  list.setModel(new DefaultListModel<T>());
  list.addListSelectionListener(listener);
  list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  list.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED), title == null ? "" : title));
  final JScrollPane scrollPane = new JScrollPane(list);
  scrollPane.setBorder(BorderFactory.createEmptyBorder());
  GuiUtils.adjustScrollbarsThickness(scrollPane);
  scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  list.setCellRenderer(new TooltippedListCellRenderer());
  return scrollPane;
}
 
Example 22
Source Project: openjdk-jdk8u   Source File: MemoryMonitor.java    License: GNU General Public License v2.0 5 votes vote down vote up
public MemoryMonitor() {
    setLayout(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
    add(surf = new Surface());
    controls = new JPanel();
    controls.setPreferredSize(new Dimension(135,80));
    Font font = new Font("serif", Font.PLAIN, 10);
    JLabel label = new JLabel("Sample Rate");
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(label);
    tf = new JTextField("1000");
    tf.setPreferredSize(new Dimension(45,20));
    controls.add(tf);
    controls.add(label = new JLabel("ms"));
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(dateStampCB);
    dateStampCB.setFont(font);
    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
           removeAll();
           if ((doControls = !doControls)) {
               surf.stop();
               add(controls);
           } else {
               try {
                   surf.sleepAmount = Long.parseLong(tf.getText().trim());
               } catch (Exception ex) {}
               surf.start();
               add(surf);
           }
           validate();
           repaint();
        }
    });
}
 
Example 23
Source Project: sldeditor   Source File: MenuComboBox.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new combo menu.
 *
 * @param label the label
 */
public ComboMenu(String label) {
    super(label);
    iconRenderer = new ArrowIcon(SwingConstants.SOUTH, true);
    setBorder(new EtchedBorder());
    setIcon(new BlankIcon(null, 11));
    setHorizontalTextPosition(JButton.LEFT);
    setFocusPainted(true);
}
 
Example 24
Source Project: jdk8u-dev-jdk   Source File: MemoryMonitor.java    License: GNU General Public License v2.0 5 votes vote down vote up
public MemoryMonitor() {
    setLayout(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
    add(surf = new Surface());
    controls = new JPanel();
    controls.setPreferredSize(new Dimension(135,80));
    Font font = new Font("serif", Font.PLAIN, 10);
    JLabel label = new JLabel("Sample Rate");
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(label);
    tf = new JTextField("1000");
    tf.setPreferredSize(new Dimension(45,20));
    controls.add(tf);
    controls.add(label = new JLabel("ms"));
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(dateStampCB);
    dateStampCB.setFont(font);
    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
           removeAll();
           if ((doControls = !doControls)) {
               surf.stop();
               add(controls);
           } else {
               try {
                   surf.sleepAmount = Long.parseLong(tf.getText().trim());
               } catch (Exception ex) {}
               surf.start();
               add(surf);
           }
           validate();
           repaint();
        }
    });
}
 
Example 25
Source Project: netbeans   Source File: TemplateWizard1.java    License: Apache License 2.0 5 votes vote down vote up
/** Prepares decription area with html browser inside.
 * Executed in other then event dispatch thread.
 */
public void construct() {
    initData = new InitData();
    initData.browser = new HtmlBrowser(false, false);
    initData.browser.setName("browser");
    initData.noDescMsg = NbBundle.getBundle(TemplateWizard1.class).
                        getString("MSG_NoDescription");
    initData.noDescBorder = new EtchedBorder();

    // override the Swing default CSS to make the HTMLEditorKit use the
    // same font as the rest of the UI
    
    Component comp = initData.browser.getBrowserComponent();
    if (! (comp instanceof javax.swing.JEditorPane))
        return;

    javax.swing.text.EditorKit kit = ((javax.swing.JEditorPane) comp).getEditorKitForContentType("text/html"); // NOI18N
    if (! (kit instanceof javax.swing.text.html.HTMLEditorKit))
        return;

    javax.swing.text.html.HTMLEditorKit htmlkit = (javax.swing.text.html.HTMLEditorKit) kit;

    // XXX the style sheet is shared by all HTMLEditorKits.  We must
    // detect if it has been tweaked by ourselves or someone else
    // (template description for example) and avoid doing the same
    // thing again
    
    if (htmlkit.getStyleSheet().getStyleSheets() != null)
        return;
    
    javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
    java.awt.Font f = new javax.swing.JTextArea().getFont();
    css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
                .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
    css.addStyleSheet(htmlkit.getStyleSheet());
    htmlkit.setStyleSheet(css);
}
 
Example 26
Source Project: netbeans   Source File: NbTheme.java    License: Apache License 2.0 5 votes vote down vote up
private final void handleEtchedBorder (org.xml.sax.AttributeList atts) {
    String key = atts.getValue (KEY_ATTR);
    int i = EtchedBorder.LOWERED;
    String type = atts.getValue (TYPE_ATTR);
    if (type != null) 
        i = type.equals (TYPE_LOWERED) ? EtchedBorder.LOWERED : EtchedBorder.RAISED;
    BorderUIResource.EtchedBorderUIResource resource = new BorderUIResource.EtchedBorderUIResource (i);
    defaults.put (key, resource);
}
 
Example 27
Source Project: netbeans   Source File: BorderBuilders.java    License: Apache License 2.0 5 votes vote down vote up
EtchedBorderBuilder(Instance instance, Heap heap) {
    super(instance, heap);
    
    etchType = DetailsUtils.getIntFieldValue(instance, "etchType", EtchedBorder.LOWERED);
    highlight = ColorBuilder.fromField(instance, "highlight", heap);
    shadow = ColorBuilder.fromField(instance, "shadow", heap);
}
 
Example 28
Source Project: GpsPrune   Source File: DetailsDisplay.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Make a details subpanel
 * @param inNameKey key to use for top label
 * @param inFont font for top label
 * @return panel with correct layout, label
 */
private static JPanel makeDetailsPanel(String inNameKey, Font inFont)
{
	JPanel detailsPanel = new JPanel();
	detailsPanel.setLayout(new BoxLayout(detailsPanel, BoxLayout.Y_AXIS));
	detailsPanel.setBorder(BorderFactory.createCompoundBorder(
		BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(3, 3, 3, 3))
	);
	JLabel detailsLabel = new JLabel(I18nManager.getText(inNameKey));
	detailsLabel.setFont(inFont);
	detailsPanel.add(detailsLabel);
	return detailsPanel;
}
 
Example 29
Source Project: mzmine2   Source File: StatusBar.java    License: GNU General Public License v2.0 5 votes vote down vote up
public StatusBar() {

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    setBorder(new EtchedBorder());

    statusTextPanel = new JPanel();
    statusTextPanel.setLayout(new BoxLayout(statusTextPanel, BoxLayout.X_AXIS));
    statusTextPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED));

    statusTextLabel = new JLabel();
    statusTextLabel.setFont(statusBarFont);
    statusTextLabel.setMinimumSize(new Dimension(100, STATUS_BAR_HEIGHT));
    statusTextLabel.setPreferredSize(new Dimension(3200, STATUS_BAR_HEIGHT));

    statusTextPanel.add(Box.createRigidArea(new Dimension(5, STATUS_BAR_HEIGHT)));
    statusTextPanel.add(statusTextLabel);

    add(statusTextPanel);

    memoryLabel = new LabeledProgressBar();
    memoryPanel = new JPanel();
    memoryPanel.setLayout(new BoxLayout(memoryPanel, BoxLayout.X_AXIS));
    memoryPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
    memoryPanel.add(Box.createRigidArea(new Dimension(10, STATUS_BAR_HEIGHT)));
    memoryPanel.add(memoryLabel);
    memoryPanel.add(Box.createRigidArea(new Dimension(10, STATUS_BAR_HEIGHT)));

    memoryLabel.addMouseListener(this);

    add(memoryPanel);

    Thread memoryLabelUpdaterThread = new Thread(this, "Memory label updater thread");
    memoryLabelUpdaterThread.start();

  }
 
Example 30
Source Project: nextreports-designer   Source File: MagicToggleButton.java    License: Apache License 2.0 5 votes vote down vote up
private void buttonInit() {
//        this.setBorder(new BevelBorder(BevelBorder.RAISED));
        this.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
        this.setBorderPainted(false);
        this.setFocusPainted(false);
//        this.setMargin(new Insets(2, 2, 2, 2));

        addMouseListener(this);
    }