Java Code Examples for javax.swing.BorderFactory

The following examples show how to use javax.swing.BorderFactory. These examples are extracted from open source projects.
Example 1
Project: visualvm   File: OverviewViewSupport.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void initComponents(final ApplicationOverviewModel model) {
    setLayout(new BorderLayout());
    setOpaque(false);
    
    final HTMLTextArea area = new HTMLTextArea("<nobr>" + getGeneralProperties(model) + "</nobr>"); // NOI18N
    area.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8));
    
    DataSource source = model.getSource();
    if (source instanceof Application) {
        oomeListener = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (Jvm.PROPERTY_DUMP_OOME_ENABLED.equals(evt.getPropertyName())) {
                    int selStart = area.getSelectionStart();
                    int selEnd   = area.getSelectionEnd();
                    area.setText("<nobr>" + getGeneralProperties(model) + "</nobr>");   // NOI18N
                    area.select(selStart, selEnd);
                }
            }
        };
        Jvm jvm = JvmFactory.getJVMFor((Application)source);
        jvm.addPropertyChangeListener(WeakListeners.propertyChange(oomeListener,jvm));
    }
    add(area, BorderLayout.CENTER);
}
 
Example 2
Project: netbeans   File: SectionPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void addAction (Action action) {
    String name = (String) action.getValue(Action.NAME);
    LinkButton btn = new LinkButton(name);
    btn.addActionListener(action);
    
    if (notEmpty) {
        JLabel separator = new javax.swing.JLabel();
        separator.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createEmptyBorder(2, 0, 2, 0),
                BorderFactory.createLineBorder(Color.BLACK, 1)
        ));
        horizontalSeqGroup
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(separator)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
        verticalParallelGroup
            .addComponent(separator, GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
    }
    
    horizontalSeqGroup
            .addComponent(btn, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    verticalParallelGroup
            .addComponent(btn, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    notEmpty = true;
}
 
Example 3
Project: cakephp3-netbeans   File: CakePHP3StatusLineElementProvider.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create Component(JPanel) and add separator and JLabel to it.
 *
 * @param cell JLabel
 * @return panel
 */
private Component panelWithSeparator(JLabel cell) {
    // create separator
    JSeparator separator = new JSeparator(SwingConstants.VERTICAL) {
        private static final long serialVersionUID = -6385848933295984637L;

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(3, 3);
        }
    };
    separator.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    // create panel
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(separator, BorderLayout.WEST);
    panel.add(cell, BorderLayout.EAST);
    panel.add(versionLabel, BorderLayout.CENTER);
    return panel;
}
 
Example 4
Project: openstock   File: DefaultPolarPlotEditor.java    License: GNU General Public License v3.0 6 votes vote down vote up
private JPanel createPlotPanel() {
    JPanel plotPanel = new JPanel(new LCBLayout(3));
    plotPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    plotPanel.add(new JLabel(localizationResources.getString(
            "AngleOffset")));
    this.angleOffset = new JTextField(Double.toString(
            this.angleOffsetValue));
    this.angleOffset.setActionCommand("AngleOffsetValue");
    this.angleOffset.addActionListener(this);
    this.angleOffset.addFocusListener(this);
    plotPanel.add(this.angleOffset);
    plotPanel.add(new JPanel());

    plotPanel.add(new JLabel(localizationResources.getString(
            "Manual_TickUnit_value")));
    this.manualTickUnit = new JTextField(Double.toString(
            this.manualTickUnitValue));
    this.manualTickUnit.setActionCommand("TickUnitValue");
    this.manualTickUnit.addActionListener(this);
    this.manualTickUnit.addFocusListener(this);
    plotPanel.add(this.manualTickUnit);
    plotPanel.add(new JPanel());

    return plotPanel;
}
 
Example 5
Project: visualvm   File: JavaOverviewSummary.java    License: GNU General Public License v2.0 6 votes vote down vote up
HorizontalScroller(JComponent view) {
    super(view, VERTICAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_AS_NEEDED);

    setBorder(BorderFactory.createEmptyBorder());
    setViewportBorder(BorderFactory.createEmptyBorder());

    getViewport().setOpaque(false);
    setOpaque(false);
    
    super.addMouseWheelListener(new MouseWheelListener() {
        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.getModifiers() == MouseWheelEvent.SHIFT_MASK) {
                scroll(getHorizontalScrollBar(), e);
            } else {
                getParent().dispatchEvent(e);
            }
        }
        
    });
}
 
Example 6
Project: visualvm   File: ThreadDumpWindow.java    License: GNU General Public License v2.0 6 votes vote down vote up
public ThreadDumpWindow(ThreadDump td) {
    setLayout(new BorderLayout());
    setFocusable(true);
    setRequestFocusEnabled(true);
    setName(Bundle.ThreadDumpWindow_Caption(StringUtils.formatUserDate(td.getTime())));
    setIcon(Icons.getImage(ProfilerIcons.THREAD));

    StringBuilder text = new StringBuilder();
    printThreads(text, td);
    a = new HTMLTextArea() {
        protected void showURL(URL url) {
            if (url == null) {
                return;
            }
            String urls = url.toString();
            ThreadDumpWindow.this.showURL(urls);
        }
    };
    a.setEditorKit(new CustomHtmlEditorKit());
    a.setText(text.toString());
    a.setCaretPosition(0);
    JScrollPane sp = new JScrollPane(a);
    sp.setBorder(BorderFactory.createEmptyBorder());
    sp.setViewportBorder(BorderFactory.createEmptyBorder());
    add(sp, BorderLayout.CENTER);
}
 
Example 7
Project: Swing9patch   File: NPComponentUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new N9Component object.
 *
 * @param text the text
 * @param n9 the n9
 * @param is the is
 * @param foregroundColor the foreground color
 * @param f the f
 * @return the j label
 */
public static JLabel createLabel_root(String text
		, final NinePatch n9, Insets is
		, Color foregroundColor, Font f)
{
	JLabel l = new JLabel(text){
		public void paintComponent(Graphics g) {
			n9.draw((Graphics2D)g, 0, 0, this.getWidth(), this.getHeight());
			super.paintComponent(g);
		}
	};
	if(is != null)
		l.setBorder(BorderFactory.createEmptyBorder(is.top, is.left, is.bottom, is.right));
	if(foregroundColor != null)
		l.setForeground(foregroundColor);
	if(f != null)
		l.setFont(f);

	return l;
}
 
Example 8
Project: lucene-solr   File: LogsPanelProvider.java    License: Apache License 2.0 6 votes vote down vote up
public JPanel get() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

  JPanel header = new JPanel(new FlowLayout(FlowLayout.LEADING));
  header.setOpaque(false);
  header.add(new JLabel(MessageUtils.getLocalizedMessage("logs.label.see_also")));

  JLabel logPathLabel = new JLabel(LukeMain.LOG_FILE);
  header.add(logPathLabel);

  panel.add(header, BorderLayout.PAGE_START);

  panel.add(new JScrollPane(logTextArea), BorderLayout.CENTER);
  return panel;
}
 
Example 9
Project: pentaho-reporting   File: QueryEditorPanel.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
private JPanel createGlobalScriptTab() {
  final JPanel globalHeader2 = new JPanel( new BorderLayout() );
  globalHeader2.add( new JLabel( Messages.getString( "QueryEditorPanel.GlobalScript" ) ), BorderLayout.CENTER );
  globalHeader2.add( new JButton( globalTemplateAction ), BorderLayout.EAST );

  final JPanel globalScriptHeader = new JPanel( new VerticalLayout( 5, VerticalLayout.BOTH, VerticalLayout.TOP ) );
  globalScriptHeader.add( new JLabel( Messages.getString( "QueryEditorPanel.GlobalScriptLanguage" ) ) );
  globalScriptHeader.add( globalLanguageField );
  globalScriptHeader.add( globalHeader2 );

  final JPanel globalScriptContentHolder = new JPanel( new BorderLayout() );
  globalScriptContentHolder.add( globalScriptHeader, BorderLayout.NORTH );
  globalScriptContentHolder.add( new RTextScrollPane( 700, 600, globalScriptTextArea, true ), BorderLayout.CENTER );
  globalScriptContentHolder.setBorder( BorderFactory.createEmptyBorder( 8, 8, 8, 8 ) );
  return globalScriptContentHolder;
}
 
Example 10
Project: Spark   File: TranscriptAlert.java    License: Apache License 2.0 6 votes vote down vote up
public TranscriptAlert() {
    setLayout(new GridBagLayout());

    setBackground(new Color(250, 249, 242));
    add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));

    add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    titleLabel.setFont(new Font("Dialog", Font.BOLD, 11));
    titleLabel.setForeground(new Color(211, 174, 102));

    add(yesButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));
    add(cancelButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));

    yesButton.setForeground(new Color(73, 113, 196));
    cancelButton.setForeground(new Color(73, 113, 196));

    cancelButton.setFont(new Font("Dialog", Font.BOLD, 10));
    yesButton.setFont(new Font("Dialog", Font.BOLD, 10));

    yesButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196)));
    cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196)));

    cancelButton.setVisible(false);
    setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white));
}
 
Example 11
Project: dkpro-jwpl   File: LoggingPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void createDiffToolLoggingSettings()
{
	diffToolLabel = new JLabel("Logging Root Folder: ");
	diffToolLabel.setBorder(BorderFactory.createRaisedBevelBorder());
	diffToolLabel.setBounds(10, 10, 150, 25);
	this.add(diffToolLabel);

	diffToolField = new JTextField();
	diffToolField.setBounds(170, 10, 200, 25);
	this.add(diffToolField);

	diffToolLogLevelComboBox = new JComboBox<>();
	diffToolLogLevelComboBox.setBounds(390, 10, 100, 25);

	diffToolLogLevelComboBox.addItem(Level.ERROR);
	diffToolLogLevelComboBox.addItem(Level.WARN);
	diffToolLogLevelComboBox.addItem(Level.INFO);
	diffToolLogLevelComboBox.addItem(Level.DEBUG);
	diffToolLogLevelComboBox.addItem(Level.TRACE);

	this.add(diffToolLogLevelComboBox);
}
 
Example 12
Project: mqtt-jmeter   File: PubSamplerUI.java    License: Apache License 2.0 6 votes vote down vote up
private JPanel createPubOption() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Pub options"));

	qosChoice = new JLabeledChoice("QoS Level:", new String[] { String.valueOf(QOS_0), String.valueOf(QOS_1), String.valueOf(QOS_2) }, true, false);
	qosChoice.addChangeListener(this);

	JPanel optsPanel = new HorizontalPanel();
	optsPanel.add(qosChoice);
	optsPanel.add(retainedMsg);
	optsPanel.add(topicName);
	topicName.setToolTipText("Name of topic that the message will be sent to.");
	optsPanel.add(timestamp);
	optsPanelCon.add(optsPanel);

	return optsPanelCon;
}
 
Example 13
Project: stendhal   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 14
Project: netbeans   File: ResultPanelTree.java    License: Apache License 2.0 6 votes vote down vote up
ResultPanelTree(ResultDisplayHandler displayHandler, StatisticsPanel statPanel) {
        super(new BorderLayout());
        treeView = new ResultTreeView();
        treeView.getAccessibleContext().setAccessibleName(Bundle.ACSN_TestResults());
        treeView.getAccessibleContext().setAccessibleDescription(Bundle.ACSD_TestResults());
        treeView.setBorder(BorderFactory.createEtchedBorder());
//        resultBar.setPassedPercentage(0.0f);
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        toolBar.add(resultBar);
        toolBar.setBorder(BorderFactory.createEtchedBorder());

        add(toolBar, BorderLayout.NORTH);
        add(treeView, BorderLayout.CENTER);

        explorerManager = new ExplorerManager();
        explorerManager.setRootContext(rootNode = new RootNode(displayHandler.getSession(), filterMask));
        explorerManager.addPropertyChangeListener(this);

        initAccessibility();

        this.displayHandler = displayHandler;
        this.statPanel = statPanel;
        displayHandler.setLookup(ExplorerUtils.createLookup(explorerManager, new ActionMap()));
    }
 
Example 15
Project: visualvm   File: UISupport.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates preformatted instance of ScrollableContainer to be used in Options
 * dialog. All insets are already initialized to defaults, the client components
 * should have zero outer insets.
 * 
 * @param contents component to be displayed
 * @return preformatted instance of ScrollableContainer
 */
public static ScrollableContainer createScrollableContainer(JComponent contents) {
    ScrollableContainer container = new ScrollableContainer(contents,
                                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    container.setViewportBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
    return container;
}
 
Example 16
Project: libreveris   File: UIUtil.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Report a standard tool border entity, which is a blank border.
 *
 * @return the standard tool border
 */
public static Border getToolBorder ()
{
    if (toolBorder == null) {
        toolBorder = BorderFactory.createEmptyBorder(1, 2, 1, 2);
    }

    return toolBorder;
}
 
Example 17
Project: netbeans   File: BrowserMenu.java    License: Apache License 2.0 5 votes vote down vote up
public void show( JComponent invoker, int x, int y ) {
    JPanel panel = new JPanel();
    panel.setOpaque( false );
    fillContent( panel );

    popup = new JPopupMenu();
    popup.add( panel );
    if( windowsLaF ) {
        popup.setBorder( BorderFactory.createLineBorder( windowsSeparatorColor.darker() ));
    }
    popup.show( invoker, x, y );
}
 
Example 18
Project: gameserver   File: ManageAccountStatusDialog.java    License: Apache License 2.0 5 votes vote down vote up
public void init() {
	this.setTitle("管理账户状态");
	this.setSize(320, 430);
	Point p = WindowUtils.getPointForCentering(this);
	this.setLocation(p);
	this.setModal(true);
	this.statusField.setActionCommand(CMD_STATUS_SELECT);
	this.statusField.addActionListener(this);
	this.statusField.setSelectedIndex(0);
	
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	this.previewButton.setActionCommand(CMD_PREVIEW);
	this.previewButton.addActionListener(this);
	
	JXPanel loginPanel = new JXPanel(new MigLayout("wrap 2, gap 10px", "[45%][55%]"));
	loginPanel.add(this.statusLabel, "sg lbl");
	loginPanel.add(this.statusField, "sg fd, grow");
	loginPanel.add(this.descField, "span, grow");
	loginPanel.add(this.previewButton, "gaptop 5px, span, split 3, align center");		
	loginPanel.setBorder(BorderFactory.createTitledBorder("登陆管理"));
					
	JXPanel panel = new JXPanel(new MigLayout("wrap 1, gap 10px", "[100%]"));
	this.setLayout(new MigLayout("wrap 1"));
	panel.add(loginPanel);
	panel.add(this.okButton, "gaptop 5px, span, split 3, align center");
	panel.add(this.cancelButton);

	this.add(panel, "width 100%, height 100%");
}
 
Example 19
Project: jpexs-decompiler   File: ColorEditor.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ColorEditor(String fieldName, Object obj, Field field, int index, Class<?> type) {
    this.obj = obj;
    this.field = field;
    this.index = index;
    this.type = type;
    this.fieldName = fieldName;

    setLayout(new FlowLayout());

    buttonChange = new JButton("") {

        @Override
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintBorder(g);
        }

    };
    buttonChange.setToolTipText(AppStrings.translate("button.selectcolor.hint"));
    buttonChange.setCursor(new Cursor(Cursor.HAND_CURSOR));
    buttonChange.addActionListener(this);

    buttonChange.setBorderPainted(true);
    buttonChange.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    Dimension colorDim = new Dimension(16, 16);
    buttonChange.setSize(colorDim);
    buttonChange.setPreferredSize(colorDim);
    add(buttonChange);
    reset();
}
 
Example 20
Project: ccu-historian   File: DateChooserPanel.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns a panel that appears at the bottom of the calendar panel - 
 * contains a button for selecting today's date.
 *
 * @return the panel.
 */
private JPanel constructControlPanel() {

    final JPanel p = new JPanel();
    p.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 5));
    this.todayButton = new JButton("Today");
    this.todayButton.addActionListener(this);
    this.todayButton.setActionCommand("todayButtonClicked");
    p.add(this.todayButton);
    return p;

}
 
Example 21
Project: netbeans   File: ProfilerToolbar.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Component add(ProfilerToolbar toolbar, int index) {
    JToolBar implToolbar = ((Impl)toolbar).toolbar;
    implToolbar.setBorder(BorderFactory.createEmptyBorder());
    implToolbar.setOpaque(false);
    implToolbar.putClientProperty("Toolbar.noGTKBorder", Boolean.TRUE); // NOI18N
    return add(implToolbar, index);
}
 
Example 22
Project: mqtt-jmeter   File: CommonConnUI.java    License: Apache License 2.0 5 votes vote down vote up
public JPanel createAuthentication() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "User authentication"));
	
	JPanel optsPanel = new HorizontalPanel();
	optsPanel.add(userNameAuth);
	optsPanel.add(passwordAuth);
	optsPanelCon.add(optsPanel);
	
	return optsPanelCon;
}
 
Example 23
Project: tmc-intellij   File: SuccessfulSubmissionDialog.java    License: MIT License 5 votes vote down vote up
public SuccessfulSubmissionDialog(Exercise exercise, SubmissionResult result, Project project) {
    logger.info("Creating SuccessfulSubmissionDialog. @SuccessfulSubmissionDialog");
    this.setTitle(exercise.getName() + " passed");

    JPanel contentPane = new JPanel();
    contentPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    setContentPane(contentPane);

    addYayLabel();
    addVSpace(6);

    if (exercise.requiresReview() && !result.getMissingReviewPoints().isEmpty()) {
        addRequiresReviewLabels();
    }

    addVSpace(6);
    addPointsLabel(result);
    addVSpace(10);
    addModelSolutionButton(result, project);
    addVSpace(20);
    addFeedbackQuestions(result); // TODO: maybe put in box
    addVSpace(10);
    addOkButton();
    addNextExerciseButton();
    addNextExerciseListener(result, project);
    addOkListener(result, project);
    setAlwaysOnTop(true);

    pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    this.requestFocusInWindow(true);
}
 
Example 24
Project: JCEditor   File: ButtonTabComponent.java    License: GNU General Public License v2.0 5 votes vote down vote up
public ButtonTabComponent(final JTabbedPane pane, ArrayList<AreaDeTexto> adts, ArrayList<String> arqsAbertos) {
    //unset default FlowLayout' gaps
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    if (pane == null) {
        throw new NullPointerException("");
    }
    this.pane = pane;
    this.adts = adts;
    this.arquivosAbertos = arqsAbertos;
    setOpaque(false);
    
    //make JLabel read titles from JTabbedPane
    JLabel label = new JLabel() {
        public String getText() {
            int i = pane.indexOfTabComponent(ButtonTabComponent.this);
            if (i != -1) {
                return pane.getTitleAt(i);
            }
            return null;
        }
    };
    
    add(label);
    //add more space between the label and the button
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    //tab button
    JButton button = new TabButton();
    add(button);
    //add more space to the top of the component
    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}
 
Example 25
Project: TrakEM2   File: StdOutWindow.java    License: GNU General Public License v3.0 5 votes vote down vote up
private Component wrap(Component c, String title) {
	JScrollPane s = new JScrollPane(c);
	s.setBackground(Color.white);
	s.setMinimumSize(new Dimension(400,15));
	s.setPreferredSize(new Dimension(400,200));
	s.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0,5,0,5), title));
	return s;
}
 
Example 26
Project: sldeditor   File: MapRender.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the map pane.
 *
 * @return the j map pane
 */
private SLDMapPane createMapPane() {
    SLDMapPane internalMapPane = new SLDMapPane();
    internalMapPane.setBackground(
            PrefManager.getInstance().getPrefData().getBackgroundColour());
    internalMapPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    return internalMapPane;
}
 
Example 27
Project: visualvm   File: BorderBuilders.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected Border createInstanceImpl() {
    Insets i = insets.createInstance();
    if (i.top == 0 && i.left == 0 && i.bottom == 0 && i.right == 0) {
        return BorderFactory.createEmptyBorder();
    } else {
        return BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right);
    }
}
 
Example 28
Project: magarena   File: FilterButton.java    License: GNU General Public License v3.0 5 votes vote down vote up
void setActiveFlag(boolean isActive) {
    setFont(isActive ? ON_FONT : OFF_FONT);
    setBorder(isActive 
            ? BorderFactory.createMatteBorder(2, 2, 2, 2, MagicStyle.getRolloverColor())
            : null
    );
}
 
Example 29
Project: visualvm   File: OQLEditorComponent.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void clearScrollBorders() {
    if (getComponentCount() > 0) {
        Component c = getComponent(0);
        if (c instanceof JScrollPane) {
            ((JScrollPane)c).setBorder(BorderFactory.createEmptyBorder());
            ((JScrollPane)c).setViewportBorder(BorderFactory.createEmptyBorder());
        }
    }
}
 
Example 30
Project: geomajas-project-server   File: LegendBuilder.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * No -arguments constructor.
 */
public LegendBuilder() {
	legendPanel = new JPanel();
	legendPanel.setLayout(new BoxLayout(legendPanel, BoxLayout.Y_AXIS));
	border = BorderFactory.createTitledBorder("Legend");
	legendPanel.setBorder(border);
}
 
Example 31
Project: GIFKR   File: ImageSequence.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public FieldControlsPanel getFrameControl(ChangeListener listener) {
	ArrayList<FieldControl> fieldControls = new ArrayList<>();
	if(getFrameCount() > 1) {
		try {

			ChangeListener l2 = ce -> {
				if(frame > frames)
					frame = 0;
				listener.stateChanged(ce);
			};

			FieldControl fc = new FieldControl(ImageSequence.class.getDeclaredField("frame"), this, l2);
			IntInterpolator interp = (IntInterpolator) fc.getInterpolator();
			interp.setMax(frames-1);
			fc.allowAnimationControls(true);
			fc.setAnimationLock(true);
			fieldControls.add(fc);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	fcp = new FieldControlsPanel(fieldControls, "", false);
	fcp.setBorder(BorderFactory.createEmptyBorder());
	fcp.setVisible(getFrameCount() > 1);
	return fcp;
}
 
Example 32
Project: mvisc   File: ThumbnailList.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ThumbnailList()
	{
		metaDataEntries = new ArrayList<MetaData>();
		
		
		content = new JPanel();
		content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
		
//		thumbnailScrollPane = new JScrollPane(content);
		content.setBackground(new Color(133,133,133));
		this.setViewportView(content);
		this.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	}
 
Example 33
Project: openjdk-8   File: ControlFlowScene.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 34
Project: seaglass   File: SeaGlassLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the list settings.
 *
 * @param d the UI defaults map.
 */
private void defineLists(UIDefaults d) {
    String p = "List";

    d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
    d.put(p + ".opaque", Boolean.TRUE);

    d.put(p + ".background", d.get("seaGlassLightBackground"));
    d.put(p + ".dropLineColor", d.get("seaGlassFocus"));
    d.put(p + ".rendererUseListColors", Boolean.TRUE);
    d.put(p + ".rendererUseUIBorder", Boolean.TRUE);
    d.put(p + ".cellNoFocusBorder", new BorderUIResource(BorderFactory.createEmptyBorder(2, 5, 2, 5)));
    d.put(p + ".focusCellHighlightBorder",
          new BorderUIResource(new PainterBorder("Tree:TreeCell[Enabled+Focused].backgroundPainter",
                                                 new Insets(2, 5, 2, 5))));

    // TODO Why doesn't ColorUIResource work here?
    d.put(p + "[Selected].textForeground", Color.WHITE);
    d.put(p + "[Selected].textBackground", d.get("seaGlassSelection"));
    d.put(p + "[Disabled+Selected].textBackground", Color.WHITE);
    d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText"));

    p = "List:\"List.cellRenderer\"";
    d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
    d.put(p + ".opaque", Boolean.TRUE);
    d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText"));
    d.put(p + "[Disabled].background", d.get("seaGlassSelectionBackground"));
}
 
Example 35
Project: visualvm   File: MBeansNotificationsView.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());
    setOpaque(false);

    JPanel notifications = mbeansTab.getNotificationsPanel();

    JScrollPane notificationsScrollPane = new JScrollPane(notifications, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    notificationsScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());

    add(notificationsScrollPane, BorderLayout.CENTER);
}
 
Example 36
Project: osp   File: DataTable.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
  // value is column name
  String name = (value==null) ? "" : value.toString(); //$NON-NLS-1$
  textLine.setText(name);
  if (OSPRuntime.isMac()) {
  	name = TeXParser.removeSubscripting(name);
  }
  Component c = renderer.getTableCellRendererComponent(table, name, isSelected, hasFocus, row, col);
  if (!(c instanceof JComponent)) {
    return c;
  }
  JComponent comp = (JComponent) c;
  int sortCol = decorator.getSortedColumn();
  Font font = comp.getFont();
  if (OSPRuntime.isMac()) {
  	// textline doesn't work on OSX
    comp.setFont((sortCol!=convertColumnIndexToModel(col))? 
    		font.deriveFont(Font.PLAIN) : 
    		font.deriveFont(Font.BOLD));
    if (comp instanceof JLabel) {
    	((JLabel)comp).setHorizontalAlignment(SwingConstants.CENTER);
    }
    return comp;
  }
  java.awt.Dimension dim = comp.getPreferredSize();
  dim.height += 1;
  panel.setPreferredSize(dim);
  javax.swing.border.Border border = comp.getBorder();
  if (border instanceof javax.swing.border.EmptyBorder) {
    border = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
  }
  panel.setBorder(border);
  // set font: bold if sorted column
  textLine.setFont((sortCol!=convertColumnIndexToModel(col)) ? font : font.deriveFont(Font.BOLD));
  textLine.setColor(comp.getForeground());
  textLine.setBackground(comp.getBackground());
  panel.setBackground(comp.getBackground());
  return panel;
}
 
Example 37
Project: snap-desktop   File: TimeSeriesMatrixTopComponent.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void initUI() {
    SnapApp.getDefault().getSelectionSupport(ProductSceneView.class).addHandler(sceneViewListener);

    dateLabel = new JLabel(String.format(DATE_PREFIX + " %s", getStartDateString()));
    matrixSizeSpinner = new JSpinner(new SpinnerNumberModel(MATRIX_DEFAULT_VALUE,
                                                            MATRIX_MINIMUM, MATRIX_MAXIMUM,
                                                            MATRIX_STEP_SIZE));
    final JComponent editor = matrixSizeSpinner.getEditor();
    if (editor instanceof JSpinner.DefaultEditor) {
        ((JSpinner.DefaultEditor) editor).getTextField().setEditable(false);
    }
    matrixSizeSpinner.addChangeListener(e -> matrixModel.setMatrixSize((Integer) matrixSizeSpinner.getModel().getValue()));

    final TableLayout tableLayout = new TableLayout(2);
    tableLayout.setTablePadding(4, 4);
    tableLayout.setTableFill(TableLayout.Fill.BOTH);
    tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    tableLayout.setTableWeightX(0.0);
    tableLayout.setTableWeightY(0.0);
    tableLayout.setColumnWeightX(0, 1.0);
    tableLayout.setRowWeightY(1, 1.0);
    tableLayout.setCellColspan(0, 0, 2);

    setLayout(tableLayout);
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    JPanel buttonPanel = createButtonPanel();
    JPanel tablePanel = createTablePanel();
    add(dateLabel);
    add(tablePanel);
    add(buttonPanel);

    setCurrentView(SnapApp.getDefault().getSelectedProductSceneView());
    setDisplayName(Bundle.CTL_TimeSeriesMatrixTopComponentName());
}
 
Example 38
Project: jpexs-decompiler   File: BinaryPanel.java    License: GNU General Public License v3.0 5 votes vote down vote up
public BinaryPanel(final MainPanel mainPanel) {
    super(new BorderLayout());
    this.mainPanel = mainPanel;

    add(new JScrollPane(hexEditor), BorderLayout.CENTER);

    JPanel bottomPanel = new JPanel(new BorderLayout());
    JPanel buttonsPanel = new JPanel(new FlowLayout());
    bottomPanel.add(buttonsPanel, BorderLayout.EAST);
    add(bottomPanel, BorderLayout.SOUTH);

    // todo: honfika: dynamically resize the hex data
    /*addComponentListener(new ComponentAdapter() {

     @Override
     public void componentResized(ComponentEvent e) {
     setBinaryData(binaryDataTag);
     }
     });*/
    swfInsidePanel = new JPanel();
    swfInsidePanel.setBackground(new Color(253, 205, 137));
    swfInsidePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    swfInsidePanel.add(new JLabel(AppStrings.translate("binarydata.swfInside")));
    swfInsidePanel.setFocusable(true);
    swfInsidePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    swfInsidePanel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            mainPanel.loadFromBinaryTag(binaryDataTag);
            swfInsidePanel.setVisible(false);
        }

    });
    add(swfInsidePanel, BorderLayout.NORTH);
    swfInsidePanel.setVisible(false);
}
 
Example 39
Project: otroslogviewer   File: PreviewComponent.java    License: Apache License 2.0 5 votes vote down vote up
public PreviewComponent() {
  super(new MigLayout());
  titleLabel = new JLabel(Messages.getMessage("preview.label"));
  nameLabel = new JLabel();
  contentArea = new JTextArea();
  contentArea.setEditable(false);
  border = BorderFactory.createTitledBorder(Messages.getMessage("preview.fileContent"));
  contentArea.setBorder(border);
  contentArea.setAutoscrolls(false);
  contentArea.setFont(new Font("Courier New", Font.PLAIN, contentArea.getFont().getSize()));

  contentScrollPane = new JScrollPane(contentArea);
  contentScrollPane.setAutoscrolls(false);

  progressBar = new JProgressBar();
  progressBar.setStringPainted(true);
  progressBar.setMaximum(1);
  enabledCheckBox = new JCheckBox(Messages.getMessage("preview.enable"), true);
  enabledCheckBox.setMnemonic(Messages.getMessage("preview.enable.mnemonic").charAt(0));
  enabledCheckBox.setRolloverEnabled(true);
  enabledCheckBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      boolean enabled = enabledCheckBox.isSelected();
      progressBar.setEnabled(enabled);
      contentScrollPane.setEnabled(enabled);
      contentArea.setEnabled(enabled);
      nameLabel.setEnabled(enabled);
      titleLabel.setEnabled(enabled);
    }
  });

  add(titleLabel, "dock north, gap 5 5 5 5, center");
  add(nameLabel, "dock north, gap 5 5 5 5");
  add(contentScrollPane, "dock center, gap 5 5 5 5");
  add(enabledCheckBox, "dock south, gap 0 5 5 5");
  add(progressBar, "dock south, gap 5 5 5 5");
}
 
Example 40
Project: netbeans   File: FeaturesView.java    License: Apache License 2.0 4 votes vote down vote up
public FeaturesView(Component defaultView, String buttonString) {
    if (UIUtils.isOracleLookAndFeel()) {
        setOpaque(true);
        setBackground(UIUtils.getProfilerResultsBackground());
    } else {
        setOpaque(false);
    }
    setBorder(BorderFactory.createEmptyBorder());
    setLayout(new BorderLayout(0, 0));
    
    if (defaultView != null) {
        JScrollPane sp = new JScrollPane(defaultView, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
            public Dimension getMinimumSize() { return getPreferredSize(); }
        };
        sp.getVerticalScrollBar().setUnitIncrement(20);
        sp.setBorder(null);
        sp.setViewportBorder(null);

        this.defaultView = sp;
        add(this.defaultView, BorderLayout.CENTER);
    } else {
        this.defaultView = null;
    }
    
    if (buttonString != null) {
        hintLabel = new JLabel();
        hintLabel.setIcon(Icons.getIcon(GeneralIcons.INFO));
        hintLabel.setIconTextGap(hintLabel.getIconTextGap() + 1);
        hintLabel.setOpaque(false);
        
        Font font = new JToolTip().getFont();
        
        Color f = hintLabel.getForeground();
        int r = f.getRed() + 70;
        if (r > 255) r = f.getRed() - 70; else r = Math.min(r, 70);
        int g = f.getGreen() + 70;
        if (g > 255) g = f.getRed() - 70; else g = Math.min(g, 70);
        int b = f.getBlue() + 70;
        if (b > 255) b = f.getRed() - 70; else b = Math.min(b, 70);
        hintLabel.setText("<html><body text=\"rgb(" + r + ", " + g + ", " + b + ")\" style=\"font-size: " + //NOI18N
                          (font.getSize()) + "pt; font-family: " + font.getName() + ";\">" + //NOI18N
                          Bundle.FeaturesView_noData("<b>" + buttonString + "</b>") + "</body></html>"); //NOI18N
        
        hintLabel.setSize(hintLabel.getPreferredSize());
        
        Color c = UIUtils.getProfilerResultsBackground();
        hintColor = Utils.checkedColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 245));
    } else {
        hintColor = null;
    }
}