javax.swing.border.MatteBorder Java Examples

The following examples show how to use javax.swing.border.MatteBorder. 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: MetaData.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #2
Source File: MoreImmutablesTest.java    From snake-yaml with Apache License 2.0 6 votes vote down vote up
public void testMatteBorder() {
    DumperOptions options = new DumperOptions();
    options.setWidth(400);
    Yaml yaml = new Yaml(new ImmutablesRepresenter(), options);
    Insets insets = new Insets(10, 20, 30, 40);
    Color color = new Color(100, 150, 200);
    MatteBorder border = BorderFactory.createMatteBorder(insets.top, insets.left,
            insets.bottom, insets.right, color);
    String dump = yaml.dump(border);
    assertEquals(
            "!!javax.swing.border.MatteBorder [!!java.awt.Insets [10, 20, 30, 40], !!java.awt.Color [100, 150, 200, 255]]\n",
            dump);
    Object loaded = yaml.load(dump);
    assertTrue(loaded instanceof MatteBorder);
    MatteBorder loadedBorder = (MatteBorder) loaded;
    assertEquals(insets, loadedBorder.getBorderInsets());
    assertEquals(color, loadedBorder.getMatteColor());
}
 
Example #3
Source File: MetaData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #4
Source File: MetaData.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #5
Source File: HistoryCellRenderer.java    From EchoSim with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        JList<? extends TransactionBean> list,
        TransactionBean value, int index, boolean isSelected,
        boolean cellHasFocus)
{
    JTextPane client = new JTextPane();
    client.setEditable(false);
    client.setContentType("text/html");
    TransactionRenderOpsBean ops = mRuntime.getRenderOps();
    String html = TransactionLogic.renderAsHTML(value, ops);
    int w = list.getFixedCellWidth();
    if (w < 0)
        w = 750;
    else
        w = w*3/4;
    html = "<html><body><table width=\""+w+"px\">"+html+"</table></body></html>";
    client.setText(html);
    if (cellHasFocus)
        client.setBorder(new MatteBorder(1, 5, 1, 1, Color.DARK_GRAY));
    client.setBackground(isSelected ? SELECTED : DESELECTED);
    return client;
}
 
Example #6
Source File: DialogHeader.java    From javamoney-examples with Apache License 2.0 6 votes vote down vote up
private
void
buildPanel()
{
  getHeader().setBackground(WHITE);
  getHeader().setFont(getHeader().getFont().deriveFont(Font.PLAIN));
  getHeader().setOpaque(true);

  // Build panel.
  setFill(GridBagConstraints.BOTH);
  add(getHeader(), 0, 0, 1, 1, 100, 100);
  add(getIcon(), 1, 0, 1, 1, 0, 0);

  setBackground(WHITE);
  setBorder(new MatteBorder(0, 0, 1, 0, GRAY));
  setInsets(new Insets(5, 5, 5, 5));
}
 
Example #7
Source File: MetaData.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #8
Source File: MetaData.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #9
Source File: MenuTitleDefinition.java    From nordpos with GNU General Public License v3.0 6 votes vote down vote up
public void addComponent(JPanelMenu menu) {
       
//        if (p.x > 20) {
//            p.x = 20;
//            p.y += 55;
//        }
//        p.y += 20; // 20 puntitos extra de separacion.
        
        JLabel lbl = new JLabel(AppLocal.getIntString(KeyText));
        lbl.applyComponentOrientation(menu.getComponentOrientation());
        lbl.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), new Color(0, 0, 0)));
//        lbl.setSize(670, 20);
//        lbl.setLocation(p);
//        p.y += 35;
//        comp.add(lbl);  
        
        menu.addTitle(lbl);
    }
 
Example #10
Source File: HistoryCellRenderer.java    From EchoSim with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        JList<? extends TransactionBean> list,
        TransactionBean value, int index, boolean isSelected,
        boolean cellHasFocus)
{
    JTextPane client = new JTextPane();
    client.setEditable(false);
    client.setContentType("text/html");
    TransactionRenderOpsBean ops = mRuntime.getRenderOps();
    String html = TransactionLogic.renderAsHTML(value, ops);
    int w = list.getFixedCellWidth();
    if (w < 0)
        w = 750;
    else
        w = w*3/4;
    html = "<html><body><table width=\""+w+"px\">"+html+"</table></body></html>";
    client.setText(html);
    if (cellHasFocus)
        client.setBorder(new MatteBorder(1, 5, 1, 1, Color.DARK_GRAY));
    client.setBackground(isSelected ? SELECTED : DESELECTED);
    return client;
}
 
Example #11
Source File: BorderHelper.java    From javamoney-examples with Apache License 2.0 6 votes vote down vote up
/**
 * This method creates and returns a border.
 *
 * @param title The text displayed on the border.
 * @param showBorder Whether or not to show the outlining of the border.
 *
 * @return A border.
 */
public
static
TitledBorder
createTitledBorder(String title, boolean showBorder)
{
  TitledBorder border = new TitledBorder(title);

  // Build border.
  if(showBorder == true)
  {
      border.setBorder(createEtchedBorder());
  }
  else
  {
    border.setBorder(new MatteBorder(1, 0, 0, 0, GRAY));
  }

  border.setTitleColor(BLACK);
  if (border.getTitleFont() != null) {
  	border.setTitleFont(border.getTitleFont().deriveFont(BOLD, 11.0f));
  }
  return border;
}
 
Example #12
Source File: MetaData.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #13
Source File: MetaData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #14
Source File: MetaData.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #15
Source File: FileCellRenderer.java    From workcraft with MIT License 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {

    chooseButton.setFont(table.getFont());
    chooseButton.setText(null);
    chooseButton.setToolTipText(null);

    if (value instanceof File) {
        File file = (File) value;
        if (file.exists()) {
            chooseButton.setForeground(Color.BLACK);
        } else {
            chooseButton.setForeground(Color.RED);
        }

        chooseButton.setText(file.getPath());
        chooseButton.setToolTipText(file.getAbsolutePath());

        Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
        setBorder(new MatteBorder(0, 0, 0, 0, background));
    }
    return this;
}
 
Example #16
Source File: BorderBuilders.java    From visualvm with 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 #17
Source File: MetaData.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    MatteBorder border = (MatteBorder) oldInstance;
    Insets insets = border.getBorderInsets();
    Object object = border.getTileIcon();
    if (object == null) {
        object = border.getMatteColor();
    }
    Object[] args = new Object[] {
            insets.top,
            insets.left,
            insets.bottom,
            insets.right,
            object,
    };
    return new Expression(border, border.getClass(), "new", args);
}
 
Example #18
Source File: ScreenMarkerPanel.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void updateFill()
{
	final boolean isFullyTransparent = marker.getMarker().getFill().getAlpha() == 0;

	if (isFullyTransparent)
	{
		fillColorIndicator.setBorder(null);
	}
	else
	{
		Color color = marker.getMarker().getFill();
		Color fullColor = new Color(color.getRed(), color.getGreen(), color.getBlue());
		fillColorIndicator.setBorder(new MatteBorder(0, 0, 3, 0, fullColor));
	}

	fillColorIndicator.setIcon(isFullyTransparent ? NO_FILL_COLOR_ICON : FILL_COLOR_ICON);
	opacityIndicator.setIcon(isFullyTransparent ? NO_OPACITY_ICON : FULL_OPACITY_ICON);
}
 
Example #19
Source File: KseFrame.java    From keystore-explorer with GNU General Public License v3.0 6 votes vote down vote up
private void initStatusBar() {
	jlStatusBar = new JLabel();

	int rightPadding = 3;

	if (OperatingSystem.isMacOs()) {
		rightPadding = 15; // Allow extra padding in the grow box status bar
		// if using macOS
	}

	jlStatusBar.setBorder(new CompoundBorder(new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY), new EmptyBorder(3, 3,
			3, rightPadding)));

	setDefaultStatusBarText();

	if (applicationSettings.getShowStatusBar()) {
		frame.getContentPane().add(jlStatusBar, BorderLayout.SOUTH);
	}
}
 
Example #20
Source File: DownloadingProductsPopupPanel.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
public DownloadingProductsPopupPanel(List<Pair<DownloadProductRunnable, DownloadProgressStatus>> downloadingProductRunnables,
                                     int visibleProductCount, int gapBetweenRows, int gapBetweenColumns) {

    super(null);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    Color separatorColor = UIManager.getColor("controlShadow");
    this.preferredScrollableHeight = 0;
    for (int i=0; i<downloadingProductRunnables.size(); i++) {
        Pair<DownloadProductRunnable, DownloadProgressStatus> pair = downloadingProductRunnables.get(i);
        DownloadingProductPanel downloadingProductPanel = new DownloadingProductPanel(pair.getFirst(), pair.getSecond(), gapBetweenColumns);

        int topLineHeight = (i > 0) ? 1 : 0;
        Border outsideBorder = new MatteBorder(topLineHeight, 0, 0, 0, separatorColor);
        Border insideBorder = new EmptyBorder(gapBetweenRows, gapBetweenColumns, gapBetweenRows, gapBetweenColumns);
        downloadingProductPanel.setBorder(new CompoundBorder(outsideBorder, insideBorder));
        add(downloadingProductPanel);
        if (i < visibleProductCount) {
            this.preferredScrollableHeight += downloadingProductPanel.getPreferredSize().height;
        }
    }
}
 
Example #21
Source File: ViewChooser.java    From javamoney-examples with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new view chooser.
 */
protected
ViewChooser()
{
  createLinks();

  // Build panel.
  setFill(GridBagConstraints.BOTH);
  add(createToolBarPanel(), 0, 0, 1, 1, 100, 100);

  setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));
  setInsets(new Insets(10, 15, 10, 15));
}
 
Example #22
Source File: TimePickerSettings.java    From LGoodDatePicker with MIT License 5 votes vote down vote up
/**
 * zApplyAllowKeyboardEditing, This applies the named setting to the parent component.
 */
private void zApplyAllowKeyboardEditing() {
    // Set the editability of the time picker text field.
    parent.getComponentTimeTextField().setEditable(allowKeyboardEditing);
    // Set the text field border color based on whether the text field is editable.
    Color textFieldBorderColor = (allowKeyboardEditing)
            ? InternalConstants.colorEditableTextFieldBorder
            : InternalConstants.colorNotEditableTextFieldBorder;
    parent.getComponentTimeTextField().setBorder(new CompoundBorder(
            new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2)));
}
 
Example #23
Source File: Test6910490.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    Insets insets = new Insets(10, 10, 10, 10);
    Dimension size = new Dimension(getWidth() / 2, getHeight());
    JSplitPane pane = new JSplitPane(
            JSplitPane.HORIZONTAL_SPLIT,
            create("Color", size, new MatteBorder(insets, RED)),
            create("Icon", size, new MatteBorder(insets, this)));
    pane.setDividerLocation(size.width - pane.getDividerSize() / 2);
    add(pane);
}
 
Example #24
Source File: FileReferenceCellRenderer.java    From workcraft with MIT License 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {

    enterButton.setEnabled(false);
    chooseButton.setFont(table.getFont());
    chooseButton.setText(null);
    clearButton.setEnabled(false);
    chooseButton.setToolTipText(null);

    if (value instanceof FileReference) {
        FileReference fileReference = (FileReference) value;
        File file = fileReference.getFile();
        if (file != null) {
            if (file.exists()) {
                enterButton.setEnabled(true);
                chooseButton.setForeground(Color.BLACK);
            } else {
                chooseButton.setForeground(Color.RED);
            }

            chooseButton.setText(file.getName());
            try {
                chooseButton.setToolTipText(file.getCanonicalPath());
            } catch (IOException e) {
            }
            clearButton.setEnabled(true);
        }

        Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
        setBorder(new MatteBorder(0, 0, 0, 0, background));
    }
    return this;
}
 
Example #25
Source File: PrintPreview.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
public PagePreview(int pageIndex, PageFormat pageFormat, Printable chart, int scalePercents) {
  myScalePercents = scalePercents;
  myPageIndex = pageIndex;
  myPageFormat = pageFormat;
  myPrintableChart = chart;
  setBackground(Color.white);
  setBorder(new MatteBorder(1, 1, 2, 2, Color.black));
}
 
Example #26
Source File: ScreenMarkerPanel.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void updateBorder()
{
	if (marker.getMarker().getBorderThickness() == 0)
	{
		borderColorIndicator.setBorder(null);
	}
	else
	{
		Color color = marker.getMarker().getColor();
		borderColorIndicator.setBorder(new MatteBorder(0, 0, 3, 0, color));
	}

	borderColorIndicator.setIcon(marker.getMarker().getBorderThickness() == 0 ? NO_BORDER_COLOR_ICON : BORDER_COLOR_ICON);
}
 
Example #27
Source File: CameraTab.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void mouseClicked(MouseEvent e) {
	//Log.println("Mouse Clicked");
	for (int i=0; i< thumbnails.length; i++) {
		if (e.getSource() == thumbnails[i]) {
			if (selectedThumb != -1 && selectedThumb < thumbnails.length && thumbnails[selectedThumb] != null)
			thumbnails[selectedThumb].setBorder(new MatteBorder(3, 3, 3, 3, Color.GRAY));
			this.selectedThumb = i;
			displayPictureParams(selectedThumb);
			selectThumb(i);
			saveProperties();
		}
	}
}
 
Example #28
Source File: Test6910490.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    Insets insets = new Insets(10, 10, 10, 10);
    Dimension size = new Dimension(getWidth() / 2, getHeight());
    JSplitPane pane = new JSplitPane(
            JSplitPane.HORIZONTAL_SPLIT,
            create("Color", size, new MatteBorder(insets, RED)),
            create("Icon", size, new MatteBorder(insets, this)));
    pane.setDividerLocation(size.width - pane.getDividerSize() / 2);
    add(pane);
}
 
Example #29
Source File: DemoSelectorPanel.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
protected void applyDefaults() {
    
    expandedIcon = new ArrowIcon(ArrowIcon.SOUTH,
            UIManager.getColor(SwingSet3.TITLE_FOREGROUND_KEY));
    collapsedIcon = new ArrowIcon(ArrowIcon.EAST,
            UIManager.getColor(SwingSet3.TITLE_FOREGROUND_KEY));
    
    setBorder(new MatteBorder(0,0,0,1, 
            UIManager.getColor(SwingSet3.CONTROL_MID_SHADOW_KEY)));
    
    if (titlePanel != null) {
        titlePanel.setGradientColor1(
            UIManager.getColor(SwingSet3.TITLE_GRADIENT_COLOR1_KEY));
        titlePanel.setGradientColor2(
            UIManager.getColor(SwingSet3.TITLE_GRADIENT_COLOR2_KEY));
    }

    if (demoListLabel != null) {
       demoListLabel.setForeground(UIManager.getColor(SwingSet3.TITLE_FOREGROUND_KEY));
       demoListLabel.setFont(UIManager.getFont(SwingSet3.TITLE_FONT_KEY));
    }
    if (viewPanel != null) {
        viewPanel.setBackground(UIManager.getColor(SwingSet3.SUB_PANEL_BACKGROUND_KEY));
    }        
    if (collapsePanels != null) {
        for (CollapsiblePanel collapsePanel : collapsePanels) {
            collapsePanel.setFont(
                    UIManager.getFont("CheckBox.font").deriveFont(Font.BOLD));
            collapsePanel.setForeground(UIManager.getColor(SwingSet3.TITLE_FOREGROUND_KEY));
            collapsePanel.setExpandedIcon(expandedIcon);
            collapsePanel.setCollapsedIcon(collapsedIcon);
        }
    }
    revalidate();
}
 
Example #30
Source File: ScreenMarkerPanel.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void updateBorder()
{
	if (marker.getMarker().getBorderThickness() == 0)
	{
		borderColorIndicator.setBorder(null);
	}
	else
	{
		Color color = marker.getMarker().getColor();
		borderColorIndicator.setBorder(new MatteBorder(0, 0, 3, 0, color));
	}

	borderColorIndicator.setIcon(marker.getMarker().getBorderThickness() == 0 ? NO_BORDER_COLOR_ICON : BORDER_COLOR_ICON);
}