Search in sources :

Example 1 with MatteBorder

use of javax.swing.border.MatteBorder in project processing by processing.

the class BufferedStyledDocument method updateMode.

/**
   * Change coloring, fonts, etc in response to a mode change.
   */
protected void updateMode() {
    Mode mode = editor.getMode();
    // necessary?
    MutableAttributeSet standard = new SimpleAttributeSet();
    StyleConstants.setAlignment(standard, StyleConstants.ALIGN_LEFT);
    consoleDoc.setParagraphAttributes(0, 0, standard, true);
    Font font = Preferences.getFont("console.font");
    // build styles for different types of console output
    Color bgColor = mode.getColor("console.color");
    Color fgColorOut = mode.getColor("console.output.color");
    Color fgColorErr = mode.getColor("console.error.color");
    // Make things line up with the Editor above. If this is ever removed,
    // setBorder(null) should be called instead. The defaults are nasty.
    setBorder(new MatteBorder(0, Editor.LEFT_GUTTER, 0, 0, bgColor));
    stdStyle = new SimpleAttributeSet();
    StyleConstants.setForeground(stdStyle, fgColorOut);
    StyleConstants.setBackground(stdStyle, bgColor);
    StyleConstants.setFontSize(stdStyle, font.getSize());
    StyleConstants.setFontFamily(stdStyle, font.getFamily());
    StyleConstants.setBold(stdStyle, font.isBold());
    StyleConstants.setItalic(stdStyle, font.isItalic());
    errStyle = new SimpleAttributeSet();
    StyleConstants.setForeground(errStyle, fgColorErr);
    StyleConstants.setBackground(errStyle, bgColor);
    StyleConstants.setFontSize(errStyle, font.getSize());
    StyleConstants.setFontFamily(errStyle, font.getFamily());
    StyleConstants.setBold(errStyle, font.isBold());
    StyleConstants.setItalic(errStyle, font.isItalic());
    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
        getViewport().setBackground(bgColor);
        consoleTextPane.setOpaque(false);
        consoleTextPane.setBackground(new Color(0, 0, 0, 0));
    } else {
        consoleTextPane.setBackground(bgColor);
    }
    // calculate height of a line of text in pixels
    // and size window accordingly
    FontMetrics metrics = this.getFontMetrics(font);
    int height = metrics.getAscent() + metrics.getDescent();
    //, 4);
    int lines = Preferences.getInteger("console.lines");
    //10; // unclear why this is necessary, but it is
    int sizeFudge = 6;
    setPreferredSize(new Dimension(1024, (height * lines) + sizeFudge));
    setMinimumSize(new Dimension(1024, (height * 4) + sizeFudge));
}
Also used : MatteBorder(javax.swing.border.MatteBorder) FontMetrics(java.awt.FontMetrics) Mode(processing.app.Mode) Color(java.awt.Color) Dimension(java.awt.Dimension) Font(java.awt.Font)

Example 2 with MatteBorder

use of javax.swing.border.MatteBorder in project zaproxy by zaproxy.

the class DynamicSSLWelcomeDialog method initLayout.

private void initLayout() {
    if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
        this.setSize(480, 300);
    }
    this.setPreferredSize(new Dimension(480, 300));
    JTextArea txtSslWontWork = new JTextArea();
    txtSslWontWork.setEditable(false);
    // XXX: this doesn't work like expected, it should be the same color as the control's background :-/
    txtSslWontWork.setBackground(SystemColor.control);
    txtSslWontWork.setTabSize(4);
    txtSslWontWork.setWrapStyleWord(true);
    txtSslWontWork.setLineWrap(true);
    txtSslWontWork.setForeground(Color.BLACK);
    txtSslWontWork.setText(Constant.messages.getString("dynssl.text.sslwontwork"));
    getContentPane().setLayout(new BorderLayout());
    final JPanel contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    final JPanel contentIconPane = new JPanel();
    contentPanel.add(contentIconPane, BorderLayout.WEST);
    final JLabel lblCertificateIcon = new JLabel("");
    lblCertificateIcon.setIcon(new ImageIcon(DynamicSSLWelcomeDialog.class.getResource("/resource/certificate48x54.png")));
    contentIconPane.add(lblCertificateIcon);
    final JPanel contentTextPane = new JPanel();
    contentTextPane.setBorder(new EmptyBorder(0, 10, 5, 5));
    contentPanel.add(contentTextPane, BorderLayout.CENTER);
    contentTextPane.setLayout(new BorderLayout(5, 5));
    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new MatteBorder(0, 0, 1, 0, UIManager.getColor("InternalFrame.borderShadow")));
    contentTextPane.add(panelTitle, BorderLayout.NORTH);
    {
        JLabel lblTitle = new JLabel("SSL " + Constant.messages.getString("dynssl.label.rootca"));
        panelTitle.add(lblTitle);
        lblTitle.setFont(FontUtils.getFont(Font.BOLD));
    }
    contentTextPane.add(txtSslWontWork);
    final JPanel panelButtons = new JPanel();
    contentTextPane.add(panelButtons, BorderLayout.SOUTH);
    GridBagLayout gbl_panelButtons = new GridBagLayout();
    gbl_panelButtons.columnWidths = new int[] { 25, 0, 0 };
    gbl_panelButtons.rowHeights = new int[] { 23, 23, 0 };
    gbl_panelButtons.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    gbl_panelButtons.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    panelButtons.setLayout(gbl_panelButtons);
    GridBagConstraints gbc_btnCreate = new GridBagConstraints();
    gbc_btnCreate.anchor = GridBagConstraints.WEST;
    gbc_btnCreate.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnCreate.insets = new Insets(0, 0, 5, 5);
    gbc_btnCreate.gridx = 0;
    gbc_btnCreate.gridy = 0;
    panelButtons.add(btnCreate, gbc_btnCreate);
    GridBagConstraints gbc_lblCreateCertificateNow = new GridBagConstraints();
    gbc_lblCreateCertificateNow.anchor = GridBagConstraints.WEST;
    gbc_lblCreateCertificateNow.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblCreateCertificateNow.insets = new Insets(0, 0, 5, 0);
    gbc_lblCreateCertificateNow.gridx = 1;
    gbc_lblCreateCertificateNow.gridy = 0;
    final JLabel lblCreateCertificateNow = new JLabel(Constant.messages.getString("dynssl.text.createnow"));
    panelButtons.add(lblCreateCertificateNow, gbc_lblCreateCertificateNow);
    GridBagConstraints gbc_btnLater = new GridBagConstraints();
    gbc_btnLater.anchor = GridBagConstraints.WEST;
    gbc_btnLater.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnLater.insets = new Insets(0, 0, 0, 5);
    gbc_btnLater.gridx = 0;
    gbc_btnLater.gridy = 1;
    panelButtons.add(btnLater, gbc_btnLater);
    GridBagConstraints gbc_lblNotNowBut = new GridBagConstraints();
    gbc_lblNotNowBut.anchor = GridBagConstraints.WEST;
    gbc_lblNotNowBut.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblNotNowBut.gridx = 1;
    gbc_lblNotNowBut.gridy = 1;
    final JLabel lblNotNowBut = new JLabel(Constant.messages.getString("dynssl.text.notnow"));
    panelButtons.add(lblNotNowBut, gbc_lblNotNowBut);
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) MatteBorder(javax.swing.border.MatteBorder) GridBagConstraints(java.awt.GridBagConstraints) JTextArea(javax.swing.JTextArea) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) EmptyBorder(javax.swing.border.EmptyBorder)

Example 3 with MatteBorder

use of javax.swing.border.MatteBorder in project jdk8u_jdk by JetBrains.

the class Test6910490 method init.

@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);
}
Also used : MatteBorder(javax.swing.border.MatteBorder) Insets(java.awt.Insets) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 4 with MatteBorder

use of javax.swing.border.MatteBorder in project intellij-community by JetBrains.

the class AbstractTableView method setToolbarActions.

public final void setToolbarActions(final AnAction... actions) {
    final DefaultActionGroup actionGroup = new DefaultActionGroup();
    for (final AnAction action : actions) {
        actionGroup.add(action);
    }
    if (getHelpId() != null) {
        actionGroup.add(Separator.getInstance());
        actionGroup.add(new ContextHelpAction(getHelpId()));
    }
    final ActionManager actionManager = ActionManager.getInstance();
    final ToolbarPosition position = getToolbarPosition();
    final ActionToolbar myActionToolbar = actionManager.createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR, actionGroup, position == ToolbarPosition.TOP || position == ToolbarPosition.BOTTOM);
    myActionToolbar.setTargetComponent(myInnerPanel);
    final JComponent toolbarComponent = myActionToolbar.getComponent();
    final MatteBorder matteBorder = BorderFactory.createMatteBorder(0, 0, position == ToolbarPosition.TOP ? 1 : 0, 0, JBColor.DARK_GRAY);
    toolbarComponent.setBorder(BorderFactory.createCompoundBorder(matteBorder, toolbarComponent.getBorder()));
    getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            myActionToolbar.updateActionsImmediately();
        }
    });
    add(toolbarComponent, position.getPosition());
}
Also used : MatteBorder(javax.swing.border.MatteBorder) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ContextHelpAction(com.intellij.ide.actions.ContextHelpAction) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 5 with MatteBorder

use of javax.swing.border.MatteBorder in project adempiere by adempiere.

the class MiniTable method getCellRenderer.

public TableCellRenderer getCellRenderer(int row, int column) {
    Object editorClass = null;
    try {
        editorClass = this.getColumnModel().getColumn(column).getCellEditor().getClass();
    }//  Possible NPE if the table was not setup properly.
     catch (Exception e) {
    }
    boolean editable = this.isCellEditable(row, column);
    if (editable && editorClass == MiniCellEditor.class) {
        Color borderColor = AdempierePLAF.getFieldBackground_Mandatory();
        CompoundBorder cb = null;
        //  Set the borders on the editor
        MiniCellEditor jc = ((MiniCellEditor) this.getColumnModel().getColumn(column).getCellEditor());
        if (column == 0) {
            cb = new CompoundBorder(new EmptyBorder(new Insets(0, 0, 0, 1)), new MatteBorder(1, 1, 1, 0, borderColor));
            jc.setBorder(cb);
        } else if (column == this.getColumnCount() - 1) {
            cb = new CompoundBorder(new EmptyBorder(new Insets(0, 1, 0, 0)), new MatteBorder(1, 0, 1, 1, borderColor));
            jc.setBorder(cb);
        } else {
            cb = new CompoundBorder(new EmptyBorder(new Insets(0, 1, 0, 1)), new MatteBorder(1, 0, 1, 0, borderColor));
            jc.setBorder(cb);
        }
    }
    return super.getCellRenderer(row, column);
}
Also used : MatteBorder(javax.swing.border.MatteBorder) Insets(java.awt.Insets) Color(java.awt.Color) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) SQLException(java.sql.SQLException)

Aggregations

MatteBorder (javax.swing.border.MatteBorder)9 Dimension (java.awt.Dimension)4 Insets (java.awt.Insets)4 Color (java.awt.Color)3 EmptyBorder (javax.swing.border.EmptyBorder)3 Component (java.awt.Component)2 JLabel (javax.swing.JLabel)2 CompoundBorder (javax.swing.border.CompoundBorder)2 ContextHelpAction (com.intellij.ide.actions.ContextHelpAction)1 ComboBox (com.intellij.openapi.ui.ComboBox)1 BorderLayout (java.awt.BorderLayout)1 Font (java.awt.Font)1 FontMetrics (java.awt.FontMetrics)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 SQLException (java.sql.SQLException)1 DefaultListSelectionModel (javax.swing.DefaultListSelectionModel)1 Icon (javax.swing.Icon)1