javax.swing.BorderFactory Java Examples

The following examples show how to use javax.swing.BorderFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoggingPanel.java    From dkpro-jwpl with 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 #2
Source File: QueryEditorPanel.java    From pentaho-reporting with 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 #3
Source File: OverviewViewSupport.java    From visualvm with 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 #4
Source File: SectionPanel.java    From netbeans with 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 #5
Source File: CakePHP3StatusLineElementProvider.java    From cakephp3-netbeans with 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 #6
Source File: TranscriptAlert.java    From Spark with 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 #7
Source File: LogsPanelProvider.java    From lucene-solr with 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 #8
Source File: ResultPanelTree.java    From netbeans with 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 #9
Source File: JavaOverviewSummary.java    From visualvm with 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 #10
Source File: PubSamplerUI.java    From mqtt-jmeter with 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 #11
Source File: StyleFactory.java    From stendhal with 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 #12
Source File: DefaultPolarPlotEditor.java    From openstock with 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 #13
Source File: NPComponentUtils.java    From Swing9patch with 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 #14
Source File: ThreadDumpWindow.java    From visualvm with 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 #15
Source File: SeaGlassLookAndFeel.java    From seaglass with 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 #16
Source File: ControlFlowScene.java    From openjdk-8 with 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 #17
Source File: ButtonTabComponent.java    From JCEditor with 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 #18
Source File: MBeansNotificationsView.java    From visualvm with 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 #19
Source File: BrowserMenu.java    From netbeans with 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 #20
Source File: CommonConnUI.java    From mqtt-jmeter with 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 #21
Source File: SuccessfulSubmissionDialog.java    From tmc-intellij with 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 #22
Source File: DataTable.java    From osp with 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 #23
Source File: ThumbnailList.java    From mvisc with 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 #24
Source File: ImageSequence.java    From GIFKR with 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 #25
Source File: LegendBuilder.java    From geomajas-project-server with 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 #26
Source File: StdOutWindow.java    From TrakEM2 with 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 #27
Source File: MapRender.java    From sldeditor with 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 #28
Source File: OQLEditorComponent.java    From visualvm with 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 #29
Source File: FilterButton.java    From magarena with 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 #30
Source File: BorderBuilders.java    From visualvm with 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);
    }
}