Java 类java.awt.Insets 实例源码

项目:incubator-netbeans    文件:Preview.java   
private void addPapers() {
//out("Add papers");
        myPaperPanel.removeAll();

        if (getPaperCount() == 0) {
            updatePaperPanel();
            return;
        }
        int gap = getGap();
        GridBagConstraints c = new GridBagConstraints();
        c.insets = new Insets(gap, gap, 0, 0);

        if (isSingleMode()) {
            myPaperPanel.add(myPapers.get(myPaperNumber - 1), c);
        }
        else {
            for (Paper paper : myPapers) {
                c.gridx = paper.getColumn();
                c.gridy = paper.getRow();
                myPaperPanel.add(paper, c);
            }
        }
        updatePaperPanel();
    }
项目:jmt    文件:JMTFrame.java   
/**
 * Sets size of this window and centers it on the page
 * @param width width of the window
 * @param height height of the window
 */
public void centerWindow(int width, int height) {
    //size of the screen
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

    //reads insets given by task bars
    Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration());
    int availableWidth = screenSize.width - insets.left - insets.right;
    int availableHeight = screenSize.height - insets.top - insets.bottom;

    // Avoid to draw screens that are not visible and above taskbar
    if (width > availableWidth) {
        width = availableWidth;
    }

    if (height > availableHeight) {
        height = availableHeight;
    }

    //gets dimensions of the screen to center window.
    int xOffset = insets.left + (availableWidth - width) / 2;
    int yOffset = insets.top + (availableHeight - height) / 2;

    setBounds(xOffset, yOffset, width, height);
}
项目:Lernkartei_2017    文件:Push.java   
public Push() {
  setUndecorated(true);
  setSize(300, 100);
  this.setAlwaysOnTop(true);

  // size of the screen
  final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

  // height of the task bar
  final Insets scnMax = Toolkit.getDefaultToolkit().getScreenInsets(
      getGraphicsConfiguration());
  final int taskBarSize = scnMax.bottom;

  setLocation(screenSize.width - getWidth(), screenSize.height - taskBarSize
      - getHeight());

  // background paint
  lpg = new LinearGradientPaint(0, 0, 0, getHeight() / 2, new float[] { 0f,
      0.3f, 1f }, new Color[] { new Color(0.8f, 0.8f, 1f),
      new Color(0.7f, 0.7f, 1f), new Color(0.6f, 0.6f, 1f) });

  // blue background panel
  setContentPane(new BackgroundPanel());
}
项目:rapidminer    文件:ManageDatabaseDriversDialog.java   
private void add(String labelKey, JComponent component, JComponent button) {
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = 23;
    c.weightx = 0.5D;
    c.weighty = 1.0D;
    c.fill = 1;
    c.gridheight = 1;
    ResourceLabel label = new ResourceLabel("manage_database_drivers." + labelKey, new Object[0]);
    label.setLabelFor(component);
    c.gridwidth = 0;
    this.add(label, c);
    c.insets = new Insets(0, 0, 5, 0);
    if(button == null) {
        c.gridwidth = 0;
        this.add(component, c);
    } else {
        c.gridwidth = -1;
        c.weightx = 1.0D;
        this.add(component, c);
        c.gridwidth = 0;
        c.weightx = 0.0D;
        c.insets = new Insets(0, 5, 5, 0);
        this.add(button, c);
    }

}
项目:incubator-netbeans    文件:NotificationCenterTopComponent.java   
private void initLeft() {
    final JPanel pnlLeft = new JPanel(new GridBagLayout());
    notificationTable = (NotificationTable) notificationManager.getComponent();
    initNotificationTable();
    notificationScroll = new JScrollPane(notificationTable);

    pnlSearch = new JPanel(new GridBagLayout());
    GridBagConstraints searchConstrains = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    quickSearch = QuickSearch.attach(pnlSearch, searchConstrains, filterCallback, true);
    pnlSearch.add(new JLabel(), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    setSearchVisible(btnSearch.isSelected());

    pnlLeft.add(pnlSearch, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    pnlLeft.add(notificationScroll, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    splitPane.setLeftComponent(pnlLeft);
}
项目:incubator-netbeans    文件:NotifyExcPanel.java   
private static JComponent getDetailsPanel(String summary) {
    JPanel details = new JPanel(new GridBagLayout());
    details.setOpaque(false);
    JLabel lblMessage = new JLabel(summary);

    JButton reportLink = new JButton("<html><a href=\"_blank\">" + NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionReport")); //NOI18N
    reportLink.setFocusable(false);
    reportLink.setBorder(BorderFactory.createEmptyBorder());
    reportLink.setBorderPainted(false);
    reportLink.setFocusPainted(false);
    reportLink.setOpaque(false);
    reportLink.setContentAreaFilled(false);
    reportLink.addActionListener(flash);
    reportLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    details.add(reportLink, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
    details.add(lblMessage, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
    return details;
}
项目:incubator-netbeans    文件:RecentProjectsPanel.java   
private JPanel rebuildContent(List<UnloadedProjectInformation> projects) {
    JPanel panel = new JPanel( new GridBagLayout() );
    panel.setOpaque( false );
    int row = 0;
    for( UnloadedProjectInformation p : projects ) {
        addProject( panel, row++, p );
        if( row >= MAX_PROJECTS )
            break;
    }
    if( 0 == row ) {
        panel.add( new JLabel(BundleSupport.getLabel( "NoRecentProject" )), //NOI18N
                new GridBagConstraints( 0,row,1,1,1.0,1.0,
                    GridBagConstraints.CENTER, GridBagConstraints.NONE,
                    new Insets(10,10,10,10), 0, 0 ) );
    } else {
        panel.add( new JLabel(), new GridBagConstraints( 0,row,1,1,0.0,1.0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE,
            new Insets(0,0,0,0), 0, 0 ) );
    }
    return panel;
}
项目:oxygen-git-plugin    文件:ChangesPanel.java   
/**
 * Adds the switchView button the the panel
 * 
 * @param gbc
 *          - the constraints used for this component
 */
private void addSwitchViewButton(GridBagConstraints gbc) {
    gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
            UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
    gbc.anchor = GridBagConstraints.EAST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 0;
    JToolBar toolbar = new JToolBar();
    switchViewButton = new ToolbarButton(null, false);
    switchViewButton.setToolTipText(translator.getTranslation(Tags.CHANGE_TREE_VIEW_BUTTON_TOOLTIP));
    URL resource = currentViewMode == ResourcesViewMode.FLAT_VIEW 
        ? getClass().getResource(ImageConstants.TREE_VIEW)
        : getClass().getResource(ImageConstants.TABLE_VIEW);
    if (resource != null) {
      ImageIcon icon = (ImageIcon) imageUtilities.loadIcon(resource);
      switchViewButton.setIcon(icon);
    }
    toolbar.add(switchViewButton);
    toolbar.setFloatable(false);
    toolbar.setOpaque(false);
    this.add(toolbar, gbc);

}
项目:geomapapp    文件:XMImage.java   
public void zoomIn(Point p) {
    if( image==null )return;
    Insets ins = border.getBorderInsets(this);
    Rectangle rect = getVisibleRect();
    double zoomX = getZoomX();
    double zoomY = getZoomY();
    double x = (double) (p.x - ins.left) / zoomX;
    double y = (double) (p.y - ins.top) / zoomY;
    double w = (double) rect.width - ins.left - ins.right;
    double h = (double) rect.height - ins.top - ins.bottom;
    if(xAvg==1) xRep*=2;
    else xAvg /=2;
    if(yAvg==1) yRep*=2;
    else yAvg /=2;
    zoomX = getZoomX();
    zoomY = getZoomY();
    invalidate();
    int newX = (int) (x*zoomX - rect.getWidth()*.5d);
    int newY = (int) (y*zoomY - rect.getHeight()*.5d);
    synchronized(this) {
        scroller.validate();
    }
    scroller.scrollTo(new Point(newX, newY));
    repaint();
}
项目:LogisticApp    文件:DiretaPanelBuilder.java   
private void initializeComboBoxes() throws Exception {

        List<LocalidadeVO> localidades = this.cadastroRota.recuperarLocalidades();

        this.cboxOrigem = new JComboBox<LocalidadeVO>();
        this.startComboBoxValues(this.cboxOrigem, localidades);

        GridBagConstraints gbc_comboBox = new GridBagConstraints();
        gbc_comboBox.insets = new Insets(0, 0, 5, 5);
        gbc_comboBox.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBox.gridx = 3;
        gbc_comboBox.gridy = 3;
        this.panel.add(this.cboxOrigem, gbc_comboBox);

        this.cboxDestino = new JComboBox<LocalidadeVO>();
        this.startComboBoxValues(this.cboxDestino, localidades);

        GridBagConstraints gbc_comboBox_1 = new GridBagConstraints();
        gbc_comboBox_1.insets = new Insets(0, 0, 5, 5);
        gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBox_1.gridx = 3;
        gbc_comboBox_1.gridy = 8;
        this.panel.add(this.cboxDestino, gbc_comboBox_1);
    }
项目:incubator-netbeans    文件:Tutorials.java   
private int addLink( int row, DataObject dob ) {
    Action action = extractAction( dob );
    if( null != action ) {
        JPanel panel = new JPanel( new GridBagLayout() );
        panel.setOpaque(false);
        ActionButton lb = new ActionButton( action, Utils.getUrlString( dob ),
                Utils.getLinkColor(), false, dob.getPrimaryFile().getPath() );
        panel.add( lb, new GridBagConstraints(1,0,1,3,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0) );
        lb.setFont( BUTTON_FONT );

        panel.add( new JLabel(), 
                new GridBagConstraints(2,0,1,3,1.0,0.0,GridBagConstraints.WEST,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0) );

        lb.getAccessibleContext().setAccessibleName( lb.getText() );
        //TODO fix acn
        lb.getAccessibleContext().setAccessibleDescription( 
                BundleSupport.getAccessibilityDescription( "GettingStarted", lb.getText() ) ); //NOI18N
        add( panel, new GridBagConstraints( 0,row++,1,1,1.0,0.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
            new Insets(0,0,7,0), 0, 0 ) );
    }
    return row;
}
项目:parabuild-ci    文件:CombinedRangeXYPlot.java   
/**
 * Adds a subplot with a particular weight (greater than or equal to one).  The weight
 * determines how much space is allocated to the subplot relative to all the other subplots.
 *
 * @param subplot  the subplot.
 * @param weight  the weight (must be 1 or greater).
 */
public void add(XYPlot subplot, int weight) {

    // verify valid weight
    if (weight <= 0) {
        String msg = "CombinedRangeXYPlot.add(...): weight must be positive.";
        throw new IllegalArgumentException(msg);
    }

    // store the plot and its weight
    subplot.setParent(this);
    subplot.setWeight(weight);
    subplot.setInsets(new Insets(0, 0, 0, 0));
    subplot.setRangeAxis(null);
    subplot.addChangeListener(this);
    this.subplots.add(subplot);

    // keep track of total weights
    this.totalWeight += weight;
    configureRangeAxes();
    notifyListeners(new PlotChangeEvent(this));

}
项目:jdk8u-jdk    文件:MotifBorders.java   
/**
 * Reinitialize the insets parameter with this Border's current Insets.
 * @param c the component for which this border insets value applies
 * @param insets the object to be reinitialized
 */
public Insets getBorderInsets(Component c, Insets insets) {
    if (!(c instanceof JPopupMenu)) {
        return insets;
    }
    FontMetrics fm;
    int         descent = 0;
    int         ascent = 16;

    String title = ((JPopupMenu)c).getLabel();
    if (title == null) {
        insets.left = insets.top = insets.right = insets.bottom = 0;
        return insets;
    }

    fm = c.getFontMetrics(font);

    if(fm != null) {
        descent = fm.getDescent();
        ascent = fm.getAscent();
    }

    insets.top += ascent + descent + TEXT_SPACING + GROOVE_HEIGHT;
    return insets;
}
项目:AgentWorkbench    文件:JPanelBackgroundSystem.java   
/**
 * Initialise.
 */
private void initialize() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[]{0, 0};
    gridBagLayout.rowHeights = new int[]{0, 0, 0};
    gridBagLayout.columnWeights = new double[]{0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);

    jLabelServerHeader = new JLabel();
    jLabelServerHeader.setText("Agent.GUI Hintergrundsystem - Konfiguration");
    jLabelServerHeader.setFont(new Font("Dialog", Font.BOLD, 12));
    GridBagConstraints gbc_jLabelServerHeader = new GridBagConstraints();
    gbc_jLabelServerHeader.anchor = GridBagConstraints.WEST;
    gbc_jLabelServerHeader.insets = new Insets(0, 0, 5, 0);
    gbc_jLabelServerHeader.gridx = 0;
    gbc_jLabelServerHeader.gridy = 0;
    this.add(jLabelServerHeader, gbc_jLabelServerHeader);
    GridBagConstraints gbc_jCheckBoxAutoStart = new GridBagConstraints();
    gbc_jCheckBoxAutoStart.anchor = GridBagConstraints.WEST;
    gbc_jCheckBoxAutoStart.gridx = 0;
    gbc_jCheckBoxAutoStart.gridy = 1;
    this.add(getJCheckBoxAutoStart(), gbc_jCheckBoxAutoStart);


}
项目:openjdk-jdk10    文件:BasicBorders.java   
public Insets getBorderInsets(Component c) {
    Insets insets = new Insets(0,0,0,0);
    if (c instanceof BasicSplitPaneDivider) {
        BasicSplitPaneUI bspui = ((BasicSplitPaneDivider)c).
                                 getBasicSplitPaneUI();

        if (bspui != null) {
            JSplitPane splitPane = bspui.getSplitPane();

            if (splitPane != null) {
                if (splitPane.getOrientation() ==
                    JSplitPane.HORIZONTAL_SPLIT) {
                    insets.top = insets.bottom = 0;
                    insets.left = insets.right = 1;
                    return insets;
                }
                // VERTICAL_SPLIT
                insets.top = insets.bottom = 1;
                insets.left = insets.right = 0;
                return insets;
            }
        }
    }
    insets.top = insets.bottom = insets.left = insets.right = 1;
    return insets;
}
项目:rapidminer    文件:OpenProcessCard.java   
private JPanel checkForAutosaved() {
    AutoSave autosave = RapidMinerGUI.getAutoSave();
    this.autosavedProcessPresent = autosave.isRecoveryProcessPresent();
    if(this.autosavedProcessPresent) {
        JPanel recoverPanel = new JPanel(new GridBagLayout());
        recoverPanel.setBackground(WARNING_BACKGROUND_COLOR);
        recoverPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(WARNING_BORDER_COLOR, 1, true), BorderFactory.createEmptyBorder(8, 8, 8, 8)));
        JLabel interrupted = new JLabel(I18N.getGUILabel("getting_started.info_interrupted", new Object[0]));
        interrupted.setForeground(WARNING_TEXT_COLOR);
        interrupted.setFont(GettingStartedDialog.OPEN_SANS_SEMIBOLD_14);
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = 0;
        c.gridy = 0;
        recoverPanel.add(interrupted, c);
        JPanel buttonPanel = this.createRecoverButtonPanel(autosave);
        c.gridy = 1;
        c.insets = new Insets(10, 0, 0, 0);
        recoverPanel.add(buttonPanel, c);
        return recoverPanel;
    } else {
        return null;
    }
}
项目:Equella    文件:VerticalFlowLayout.java   
@Override
public Dimension preferredLayoutSize(Container container)
{
    Dimension dimension = new Dimension(0, 0);
    for( int i = 0; i < container.getComponentCount(); i++ )
    {
        Component component = container.getComponent(i);
        if( component.isVisible() )
        {
            Dimension dimension1 = component.getPreferredSize();
            dimension.width = Math.max(dimension.width, dimension1.width);
            if( i > 0 )
            {
                dimension.height += hgap;
            }
            dimension.height += dimension1.height;
        }
    }

    Insets insets = container.getInsets();
    dimension.width += insets.left + insets.right + hgap * 2;
    dimension.height += insets.top + insets.bottom + vgap * 2;
    return dimension;
}
项目:openvisualtraceroute    文件:RouteTablePanel.java   
@Override
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
    final Component c = super.getTableCellEditorComponent(table, value, isSelected, row, column);
    final JButton button = new JButton("?");
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setToolTipText(Column.WHO_IS.getLabel());
    button.setPreferredSize(new Dimension(Column.WHO_IS.getWidth(), c.getHeight()));
    button.setMaximumSize(button.getPreferredSize());
    if (Env.INSTANCE.getOs() == OS.win) {
        button.setBorder(null);
    }
    button.setEnabled(!_searching);
    button.addActionListener(e -> {
        final RoutePoint point = _route.getRoute().get(_table.convertRowIndexToModel(row));
        WhoIsPanel.showWhoIsDialog(RouteTablePanel.this, _services, point);
        if (table.isEditing()) {
            table.getCellEditor().stopCellEditing();
        }
        _whois.clear();
    });
    return button;
}
项目:openjdk-jdk10    文件:ScrollPaneLayout.java   
/**
 * Adjusts the <code>Rectangle</code> <code>available</code> based on if
 * the horizontal scrollbar is needed (<code>wantsHSB</code>).
 * The location of the hsb is updated in <code>hsbR</code>, and
 * the viewport border insets (<code>vpbInsets</code>) are used to offset
 * the hsb.  This is only called when <code>wantsHSB</code> has
 * changed, eg you shouldn't invoked adjustForHSB(true) twice.
 */
private void adjustForHSB(boolean wantsHSB, Rectangle available,
                          Rectangle hsbR, Insets vpbInsets) {
    int oldHeight = hsbR.height;
    if (wantsHSB) {
        int hsbHeight = Math.max(0, Math.min(available.height,
                                          hsb.getPreferredSize().height));

        available.height -= hsbHeight;
        hsbR.y = available.y + available.height + vpbInsets.bottom;
        hsbR.height = hsbHeight;
    }
    else {
        available.height += oldHeight;
    }
}
项目:SER316-Aachen    文件:CharTablePanel.java   
void createButtons() {
    for (int i = 0; i < chars.length; i++) {
        JButton button = new JButton(new CharAction(chars[i]));
        button.setMaximumSize(new Dimension(50, 22));
        //button.setMinimumSize(new Dimension(22, 22));
        button.setPreferredSize(new Dimension(30, 22));
        button.setRequestFocusEnabled(false);
        button.setFocusable(false);
        button.setBorderPainted(false);
        button.setOpaque(false);
        button.setMargin(new Insets(0,0,0,0));
        button.setFont(new Font("serif", 0, 14));
        if (i == chars.length-1) {
            button.setText("nbsp");
            button.setFont(new Font("Dialog",0,10));
            button.setMargin(new Insets(0,0,0,0));
        }
        this.add(button, null);
    }
}
项目:AgentWorkbench    文件:ObserverOutputTab.java   
/**
 * This method initializes this
 * @return void
 */
private void initialize() {

    GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
    gridBagConstraints1.gridx = 0;
    gridBagConstraints1.anchor = GridBagConstraints.WEST;
    gridBagConstraints1.insets = new Insets(10, 10, 0, 10);
    gridBagConstraints1.gridy = 0;
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 10, 10);
    gridBagConstraints.gridy = 1;
    gridBagConstraints.weightx = 1.0;

    jLabel = new JLabel();
    jLabel.setText("Observer-Output");
    jLabel.setFont(new Font("Dialog", Font.BOLD, 12));

    this.setSize(530, 225);
    this.setLayout(new GridBagLayout());
    this.add(getJScrollPane(), gridBagConstraints);
    this.add(jLabel, gridBagConstraints1);
}
项目:LogisticApp    文件:FracionalPanelBuilder.java   
private void initializeButtons() {
    this.btnBuscar = new JButton("Buscar");
    this.btnBuscar.addActionListener(this);
    GridBagConstraints gbc_btnBuscar = new GridBagConstraints();
    gbc_btnBuscar.insets = new Insets(0, 0, 5, 5);
    gbc_btnBuscar.gridx = 5;
    gbc_btnBuscar.gridy = 0;
    this.panelSecond.add(btnBuscar, gbc_btnBuscar);
}
项目:jermit    文件:SwingScreen.java   
/**
 * Resize to font dimensions.
 */
public void resizeToScreen() {
    // Figure out the thickness of borders and use that to set the
    // final size.
    Insets insets = getInsets();
    left = insets.left;
    top = insets.top;

    setSize(textWidth * screen.width + insets.left + insets.right,
        textHeight * screen.height + insets.top + insets.bottom);
}
项目:geomapapp    文件:XMap.java   
/**
    Gets the map coordinates (Projection object) at the curso location.
    @param mousePoint location of mouse.
    @return the coordinates of the mouse releative to the map.
 */
public Point2D getScaledPoint( Point2D mousePoint ) {
    double x = mousePoint.getX();
    double y = mousePoint.getY();
    if(mapBorder != null) {
        Insets ins = mapBorder.getBorderInsets(this);
        x -= (double) ins.left;
        y -= ins.top;
    }
    x /= zoom;
    y /= zoom;
    return new Point2D.Double(x, y);
}
项目:oxygen-git-plugin    文件:CommitPanel.java   
private void addLabel(GridBagConstraints gbc) {
    gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
            UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.gridwidth = 2;
    this.add(new JLabel(translator.getTranslation(Tags.COMMIT_MESSAGE_LABEL)), gbc);
}
项目:incubator-netbeans    文件:AwtDetailsProvider.java   
public String getDetailsString(String className, Instance instance, Heap heap) {
    if (FONT_MASK.equals(className)) {                                      // Font+
        String name = Utils.getFontName(instance, heap);
        if (name == null) name = "Default";                                 // NOI18N
        int size = DetailsUtils.getIntFieldValue(instance, "size", 10);     // NOI18N // TODO: should use default font size
        name += ", " + size + "pt";                                         // NOI18N
        int style = DetailsUtils.getIntFieldValue(instance, "style", 0);    // NOI18N
        if ((style & 1) != 0) name += ", bold";                             // NOI18N
        if ((style & 2) != 0) name += ", italic";                           // NOI18N
        return name;
    } else if (COLOR_MASK.equals(className)) {                              // Color+
        Color color = new ColorBuilder(instance, heap).createInstance();
        return color.getRed() + ", " + color.getGreen() +                   // NOI18N
               ", " + color.getBlue() + ", " + color.getAlpha();            // NOI18N
    } else if (POINT_MASK.equals(className)) {                              // Point+
        Point point = new PointBuilder(instance, heap).createInstance();
        return point.x + ", " + point.y;                                    // NOI18N
    } else if (DIMENSION_MASK.equals(className)) {                          // Dimension+
        Dimension dimension = new DimensionBuilder(instance, heap).createInstance();
        return dimension.width + ", " + dimension.height;                   // NOI18N
    } else if (RECTANGLE_MASK.equals(className)) {                          // Rectangle+
        Rectangle rectangle = new RectangleBuilder(instance, heap).createInstance();
        return rectangle.x + ", " + rectangle.y +                           // NOI18N
               ", " + rectangle.width + ", " + rectangle.height;            // NOI18N
    } else if (INSETS_MASK.equals(className)) {                             // Insets+
        Insets insets = new InsetsBuilder(instance, heap).createInstance();
        return insets.top + ", " + insets.left +                            // NOI18N
               ", " + insets.bottom + ", " + insets.right;                  // NOI18N
    } else if (TEXTATTRIBUTE_MASK.equals(className) ||                      // AttributedCharacterIterator$Attribute+
               CURSOR_MASK.equals(className)) {                             // Cursor+
        return DetailsUtils.getInstanceFieldString(
                instance, "name", heap);                                    // NOI18N
    }
    return null;
}
项目:MailCopier    文件:Main.java   
private JPanel get_Panel() {
    JPanel panel = new Wallpaper_Panel(new GridBagLayout());
    panel.setPreferredSize(new Dimension(340,290));

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;

    c.gridy = 0; c.gridx = 0;
    JPanel topGab = new JPanel();
    topGab.setOpaque(false);
    panel.add(topGab, c);

    c.insets = new Insets(0, 0, 10, 0);//top, left, bott, right
    c.gridx = 1;

    c.gridy = 1;
    panel.add(get_send_butt(), c);
    c.gridy = 2;c.gridwidth = 1; 
    panel.add(get_receive_butt(), c);
    c.gridy = 3;
    panel.add(get_settings_butt(), c);

    c.insets = new Insets(0, 0, 0, 0); // reset to default

    c.gridy = 4;
    panel.add(get_help_butt(), c);

    c.gridx = 2;

    c.gridy = 5; 
    JPanel bottGab = new JPanel();
    bottGab.setOpaque(false);
    panel.add(bottGab, c);

    return panel;
}
项目:openjdk-jdk10    文件:JTextComponentOperator.java   
/**
 * Maps {@code JTextComponent.getMargin()} through queue
 */
public Insets getMargin() {
    return (runMapping(new MapAction<Insets>("getMargin") {
        @Override
        public Insets map() {
            return ((JTextComponent) getSource()).getMargin();
        }
    }));
}
项目:jdk8u-jdk    文件:PolicyTool.java   
/**
 * Add a component to the PolicyTool window
 */
void addNewComponent(Container container, JComponent component,
    int index, int gridx, int gridy, int gridwidth, int gridheight,
    double weightx, double weighty, int fill, Insets is) {

    if (container instanceof JFrame) {
        container = ((JFrame)container).getContentPane();
    } else if (container instanceof JDialog) {
        container = ((JDialog)container).getContentPane();
    }

    // add the component at the specified gridbag index
    container.add(component, index);

    // set the constraints
    GridBagLayout gbl = (GridBagLayout)container.getLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = gridx;
    gbc.gridy = gridy;
    gbc.gridwidth = gridwidth;
    gbc.gridheight = gridheight;
    gbc.weightx = weightx;
    gbc.weighty = weighty;
    gbc.fill = fill;
    if (is != null) gbc.insets = is;
    gbl.setConstraints(component, gbc);
}
项目:incubator-netbeans    文件:BasicSearchForm.java   
public void addSeparator() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = row;
    c.gridwidth = 2;
    c.weightx = 1;
    c.insets = new Insets(5, 5, 5, 5);
    c.fill = GridBagConstraints.HORIZONTAL;
    JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
    separator.setForeground(SystemColor.controlShadow);
    add(separator, c);
    row++;
}
项目:openjdk-jdk10    文件:CGraphicsDevice.java   
public Insets getScreenInsets() {
    // the insets are queried synchronously and are not cached
    // since there are no Quartz or Cocoa means to receive notifications
    // on insets changes (e.g. when the Dock is resized):
    // the existing CGDisplayReconfigurationCallBack is not notified
    // as well as the NSApplicationDidChangeScreenParametersNotification
    // is fired on the Dock location changes only
    return nativeGetScreenInsets(displayID);
}
项目:openjdk-jdk10    文件:Test6963870.java   
void test(String uiName) {
    Border b = UIManager.getBorder(uiName);
    Insets i = b.getBorderInsets(null);
    if (i == null) {
        throw new RuntimeException("getBorderInsets() returns null for " + uiName);
    }
}
项目:incubator-netbeans    文件:GtkViewTabDisplayerUI.java   
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            19 : fm.getAscent() + 2 * fm.getDescent() + 5;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
项目:incubator-netbeans    文件:RecentProjectsPanel.java   
private void addProject( JPanel panel, int row, final UnloadedProjectInformation project ) {
    OpenProjectAction action = new OpenProjectAction( project );
    ActionButton b = new ActionButton( action, project.getURL().toString(), false, "RecentProject" ); //NOI18N
    b.setFont( BUTTON_FONT );
    b.getAccessibleContext().setAccessibleName( b.getText() );
    b.getAccessibleContext().setAccessibleDescription( 
            BundleSupport.getAccessibilityDescription( "RecentProject", b.getText() ) ); //NOI18N
    b.setIcon(project.getIcon());
    panel.add( b, new GridBagConstraints( 0,row,1,1,1.0,0.0,
        GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2,2,2,2), 0, 0 ) );
}
项目:rapidminer    文件:ProgressBarBorder.java   
@Override
public Insets getBorderInsets(Component c) {
    boolean compressed = Boolean.parseBoolean(String.valueOf(((JProgressBar) c)
            .getClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED)));
    if (compressed) {
        return new Insets(3, 3, 3, 3);

    } else {
        return new Insets(0, 3, 10, 3);
    }
}
项目:geomapapp    文件:LayerManager.java   
private JButton createButton(int icon) {
    JButton button = new JButton( Icons.getIcon(icon,false));
    button.setPressedIcon( Icons.getIcon(icon, true) );
    button.setDisabledIcon( Icons.getDisabledIcon( icon, false ));
    button.setBorder( BorderFactory.createLineBorder(Color.black));
    button.setMargin(new Insets(1,0,1,0));
    return button;
}
项目:SkinFixer    文件:SkinInstaller.java   
private SkinInstaller() {
    setTitle("SkinFixer Installer");

    Container container = getContentPane();

    container.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.ipadx = 5;
    c.ipady = 5;
    c.insets = new Insets(5, 5, 5, 5);

    JLabel title = new JLabel("SkinFixer");
    title.setFont(title.getFont().deriveFont(32F));
    container.add(title, c);

    c.gridy = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    minecraftPath = new JTextField(getSuggestedMinecraftDirectory().getAbsolutePath());
    container.add(minecraftPath, c);

    c.gridy = 2;
    JButton install = new JButton("Install");
    install.setActionCommand(VERSION_CHOOSER);
    install.addActionListener(this);
    container.add(install, c);

    setSize(400, 225);
    setResizable(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
}
项目:OpenJSharp    文件:MetalworksDocumentFrame.java   
public void layoutContainer(Container c) {
    Insets insets = c.getInsets();

    int labelWidth = 0;
    for (Component comp : labels) {
        labelWidth = Math.max(labelWidth, comp.getPreferredSize().width);
    }

    int yPos = insets.top;

    Iterator<Component> fieldIter = fields.listIterator();
    Iterator<Component> labelIter = labels.listIterator();
    while (labelIter.hasNext() && fieldIter.hasNext()) {
        JComponent label = (JComponent) labelIter.next();
        JComponent field = (JComponent) fieldIter.next();
        int height = Math.max(label.getPreferredSize().height, field.
                getPreferredSize().height);
        label.setBounds(insets.left, yPos, labelWidth, height);
        field.setBounds(insets.left + labelWidth + xGap,
                yPos,
                c.getSize().width - (labelWidth + xGap + insets.left
                + insets.right),
                height);
        yPos += (height + yGap);
    }

}
项目:jdk8u-jdk    文件:SynthTreeUI.java   
/**
 * {@inheritDoc}
 */
@Override
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
                                        Insets insets, Rectangle bounds,
                                        TreePath path, int row,
                                        boolean isExpanded,
                                        boolean hasBeenExpanded, boolean
                                        isLeaf) {
    if (drawHorizontalLines) {
        super.paintHorizontalPartOfLeg(g, clipBounds, insets, bounds,
                                       path, row, isExpanded,
                                       hasBeenExpanded, isLeaf);
    }
}
项目:incubator-netbeans    文件:Tutorials.java   
private void buildContent() {
    String rootName = "WelcomePage/TutorialsLinks";  // NOI18N
    FileObject root = FileUtil.getConfigFile( rootName );
    if( null == root ) {
        Logger.getLogger(Tutorials.class.getName()).log(Level.INFO,
                "Start page content not found: " + "FileObject: " + rootName ); //NOI18N
        return;
    }
    DataFolder folder = DataFolder.findFolder( root );
    if( null == folder ) {
        Logger.getLogger(Tutorials.class.getName()).log(Level.INFO,
                "Start page content not found: " + "DataFolder: " + rootName ); //NOI18N
        return;
    }
    DataObject[] children = folder.getChildren();
    if( null == children ) {
        Logger.getLogger(Tutorials.class.getName()).log(Level.INFO,
                "Start page content not found: " + "DataObject: " + rootName ); //NOI18N
        return;
    }

    for( int i=0; i<children.length; i++ ) {
        row = addLink( row, children[i] );
    }

    WebLink link = new WebLink(BundleSupport.getLabel("AllOnlineDocs"), BundleSupport.getURL("AllOnlineDocs"), Utils.getLinkColor(), false); //NOI18N
    link.setFont( link.getFont().deriveFont( Font.BOLD ) );
    add( link, new GridBagConstraints(0, row++, 1, 1, 0.0, 0.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(20,0,0,0), 0, 0 ) );

    add( new JLabel(), new GridBagConstraints(0, row++, 1, 1, 0.0, 1.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0, 0 ) );
}