当前位置: 首页>>代码示例>>Java>>正文


Java GridBagConstraints类代码示例

本文整理汇总了Java中java.awt.GridBagConstraints的典型用法代码示例。如果您正苦于以下问题:Java GridBagConstraints类的具体用法?Java GridBagConstraints怎么用?Java GridBagConstraints使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GridBagConstraints类属于java.awt包,在下文中一共展示了GridBagConstraints类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getObject

import java.awt.GridBagConstraints; //导入依赖的package包/类
protected GridBagConstraints getObject() {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 3;
    gbc.gridheight = 4;
    gbc.weightx = 0.1;
    gbc.weighty = 0.2;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.fill = GridBagConstraints.VERTICAL;
    gbc.insets.top = 1;
    gbc.insets.left = 2;
    gbc.insets.right = 3;
    gbc.insets.bottom = 4;
    gbc.ipadx = -1;
    gbc.ipady = -2;
    return gbc;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:java_awt_GridBagConstraints.java

示例2: addRow

import java.awt.GridBagConstraints; //导入依赖的package包/类
public void addRow(JComponent label, JComponent component) {

            GridBagConstraints c = new GridBagConstraints();
            c.gridx = 0;
            c.anchor = GridBagConstraints.NORTHWEST;
            c.gridy = row;
            c.weightx = 0;
            c.weighty = 0;
            c.insets = new Insets(5, 5, 5, 5);
            add(label, c);

            c.gridx = 1;
            c.weightx = 1;
            c.fill = GridBagConstraints.HORIZONTAL;
            add(component, c);

            row++;
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BasicSearchForm.java

示例3: initialize

import java.awt.GridBagConstraints; //导入依赖的package包/类
/**
 * This method initializes this
 * @return void
 */
private void initialize() {
	GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
	gridBagConstraints11.gridx = 0;
	gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
	gridBagConstraints11.weightx = 1.0;
	gridBagConstraints11.gridy = 1;
	
	GridBagConstraints gridBagConstraints = new GridBagConstraints();
	gridBagConstraints.fill = GridBagConstraints.BOTH;
	gridBagConstraints.weightx = 1.0;
	gridBagConstraints.weighty = 1.0;
	gridBagConstraints.gridwidth = 1;
	
	this.setSize(300, 200);
	this.setLayout(new GridBagLayout());
	this.add(getJScrollPaneTextVersion(), gridBagConstraints);
	this.add(getJPanelBottom(), gridBagConstraints11);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:23,代码来源:DynFormText.java

示例4: add

import java.awt.GridBagConstraints; //导入依赖的package包/类
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);
    }

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:27,代码来源:ManageDatabaseDriversDialog.java

示例5: SimilarityTable

import java.awt.GridBagConstraints; //导入依赖的package包/类
public SimilarityTable(DistanceMeasure measure, ExampleSet exampleSet) {
	GridBagLayout layout = new GridBagLayout();
	setLayout(layout);
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1;
	c.weighty = 1;
	c.gridwidth = GridBagConstraints.REMAINDER;

	similarityTable = new ExtendedJTable();
	SimilarityTableModel model = new SimilarityTableModel(measure, exampleSet);
	similarityTable.setModel(model);

	JScrollPane tablePane = new ExtendedJScrollPane(similarityTable);
	tablePane.setBorder(null);
	layout.setConstraints(tablePane, c);
	add(tablePane);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:SimilarityTable.java

示例6: constrainedComponent

import java.awt.GridBagConstraints; //导入依赖的package包/类
@NonNull
private static Pair<JComponent, GridBagConstraints> constrainedComponent(
        @NonNull final JComponent component,
        final int fill,
        final double weightx,
        @NonNull final Insets insets) {
    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = weightx;
    c.weighty = 0;
    c.anchor = GridBagConstraints.WEST;
    c.fill = fill;
    c.insets = insets;
    return Pair.<JComponent,GridBagConstraints>of(component,c);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:HierarchyTopComponent.java

示例7: StartPageContent

import java.awt.GridBagConstraints; //导入依赖的package包/类
public StartPageContent() {
    super( new GridBagLayout() );

    JComponent tabs = new TabbedPane( new LearnAndDiscoverTab(),
            new MyNetBeansTab(),
            new WhatsNewTab());
    tabs.setBorder(BorderFactory.createEmptyBorder(10,15,15,15));
    tabs.setOpaque(false);

    add( tabs, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(27,0,0,0), 0, 0) );

    add( new JLabel(), new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0) );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:StartPageContent.java

示例8: ShowModifiedFilesDialog

import java.awt.GridBagConstraints; //导入依赖的package包/类
/**
* Private constructor
*/
private ShowModifiedFilesDialog() {
  setLayout(new GridBagLayout());
  modifiedFiles = new JTextArea(10, 40);
  modifiedFiles.setLineWrap(true);
  modifiedFiles.setWrapStyleWord(true);
  modifiedFiles.setEditable(false);

  JScrollPane scroll = new JScrollPane(modifiedFiles);
  scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 1;
  gbc.gridwidth = 1;
  gbc.gridheight = 1;
  gbc.weightx = 0;
  gbc.weighty = 0;
  gbc.fill = GridBagConstraints.BOTH;
  gbc.anchor = GridBagConstraints.LINE_START;
  add(scroll , gbc);
}
 
开发者ID:oxygenxml,项目名称:oxygen-dita-translation-package-builder,代码行数:25,代码来源:ShowModifiedFilesDialog.java

示例9: readSettings

import java.awt.GridBagConstraints; //导入依赖的package包/类
@Override
public void readSettings(WizardDescriptor settings) {           
    sources = null;
    sourcesString = null;
    javadoc = null;
    javadocString = null;
    this.wiz = settings;
    this.component.progressPanel.setVisible (true);
    this.component.progressLabel.setVisible (true);
    
    this.progressHandle = ProgressHandleFactory.createHandle(NbBundle.getMessage(DetectPanel.class,"TXT_PlatfromDetectProgress"));
    this.component.progressPanel.removeAll();
    this.component.progressPanel.setLayout (new GridBagLayout ());
    GridBagConstraints c = new GridBagConstraints ();
    c.gridx = c.gridy = GridBagConstraints.RELATIVE;
    c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    JComponent pc = ProgressHandleFactory.createProgressComponent(this.progressHandle);
    ((GridBagLayout)this.component.progressPanel.getLayout ()).setConstraints(pc,c);
    this.component.progressPanel.add (pc);
    this.progressHandle.start ();
    task.schedule(0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DetectPanel.java

示例10: CardHeaderPanel

import java.awt.GridBagConstraints; //导入依赖的package包/类
public CardHeaderPanel(String i18nKey) {
    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(20, 0, 20, 0);
    JLabel label = new JLabel(I18N.getGUILabel(i18nKey, new Object[0])) {
        private static final long serialVersionUID = 1L;

        public void paintComponent(Graphics g) {
            SwingTools.disableClearType(this);
            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            super.paintComponent(g);
        }
    };
    label.setFont(OPEN_SANS_SEMIBOLD_18);
    label.setHorizontalTextPosition(2);
    this.add(label, gbc);
    ++gbc.gridx;
    gbc.fill = 2;
    gbc.weightx = 1.0D;
    this.add(new JLabel(), gbc);
    this.setOpaque(false);
    this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 20, 30, 20), BorderFactory.createMatteBorder(0, 0, 1, 0, GettingStartedDialog.VERY_LIGHT_GRAY)));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:CardHeaderPanel.java

示例11: initializeComboBoxes

import java.awt.GridBagConstraints; //导入依赖的package包/类
private void initializeComboBoxes() throws Exception {
	List<LocalidadeVO> localidades = this.contratacaoTransporte.recuperarLocalidades();

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

	GridBagConstraints gbc_comboBox = new GridBagConstraints();
	gbc_comboBox.gridwidth = 2;
	gbc_comboBox.fill = GridBagConstraints.BOTH;
	gbc_comboBox.insets = new Insets(0, 0, 5, 5);
	gbc_comboBox.gridx = 7;
	gbc_comboBox.gridy = 3;
	this.panelSecond.add(this.cboxOrigem, gbc_comboBox);

	this.startComboBoxValues(this.cboxOrigem, localidades);

	this.cboxDestino = new JComboBox<LocalidadeVO>();
	GridBagConstraints gbc_comboBox_1 = new GridBagConstraints();
	gbc_comboBox_1.gridwidth = 2;
	gbc_comboBox_1.insets = new Insets(0, 0, 5, 5);
	gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL;
	gbc_comboBox_1.gridx = 7;
	gbc_comboBox_1.gridy = 7;
	this.panelSecond.add(this.cboxDestino, gbc_comboBox_1);

	this.startComboBoxValues(this.cboxDestino, localidades);
}
 
开发者ID:cjlcarvalho,项目名称:LogisticApp,代码行数:27,代码来源:MenuContratacaoTransporteFrame.java

示例12: initializeButtons

import java.awt.GridBagConstraints; //导入依赖的package包/类
private void initializeButtons() {
	this.btnVoltar = new JButton("< Voltar");
	GridBagConstraints gbc_button = new GridBagConstraints();
	gbc_button.gridwidth = 2;
	gbc_button.insets = new Insets(0, 0, 5, 5);
	gbc_button.gridx = 2;
	gbc_button.gridy = 1;
	this.panelFirst.add(this.btnVoltar, gbc_button);

	this.btnFeito = new JButton("Feito");
	GridBagConstraints gbc_btnFeito = new GridBagConstraints();
	gbc_btnFeito.insets = new Insets(0, 0, 5, 5);
	gbc_btnFeito.gridx = 8;
	gbc_btnFeito.gridy = 1;
	this.panelFirst.add(this.btnFeito, gbc_btnFeito);

	this.btnFeito.addActionListener(this);
	this.btnVoltar.addActionListener(this);
}
 
开发者ID:cjlcarvalho,项目名称:LogisticApp,代码行数:20,代码来源:LocalidadeFrame.java

示例13: displayWarningLog

import java.awt.GridBagConstraints; //导入依赖的package包/类
/**
 * display the warning log
 */
void displayWarningLog(Window w) {

    ToolDialog wd = new ToolDialog
            (PolicyTool.getMessage("Warning"), tool, this, true);

    // find the location of the PolicyTool gui
    Point location = ((w == null) ?
            getLocationOnScreen() : w.getLocationOnScreen());
    //wd.setBounds(location.x + 50, location.y + 50, 500, 100);
    wd.setLayout(new GridBagLayout());

    JTextArea ta = new JTextArea();
    ta.setEditable(false);
    for (int i = 0; i < tool.warnings.size(); i++) {
        ta.append(tool.warnings.elementAt(i));
        ta.append(PolicyTool.getMessage("NEWLINE"));
    }
    addNewComponent(wd, ta, 0,
                    0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                    BOTTOM_PADDING);
    ta.setFocusable(false);

    JButton okButton = new JButton(PolicyTool.getMessage("OK"));
    ActionListener okListener = new CancelButtonListener(wd);
    okButton.addActionListener(okListener);
    addNewComponent(wd, okButton, 1,
                    0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
                    LR_PADDING);

    wd.getRootPane().setDefaultButton(okButton);
    wd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);

    wd.pack();
    wd.setLocationRelativeTo(w);
    wd.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:PolicyTool.java

示例14: ProgressPanel

import java.awt.GridBagConstraints; //导入依赖的package包/类
/** Creates new form ProgressPanel */
public ProgressPanel() {
    initComponents();
    handle = ProgressHandleFactory.createHandle(
            NbBundle.getMessage(ImportProjectAction.class, "CTL_ProgressDialogTitle")); // NOI18N
    progress = ProgressHandleFactory.createProgressComponent(handle);
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(450, 80));
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 5);
    add(progress, gridBagConstraints);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ProgressPanel.java

示例15: setViewComponent

import java.awt.GridBagConstraints; //导入依赖的package包/类
private void setViewComponent( Component component) {
    if (viewComponent == component) {
        return;
    }
    if (viewComponent != null) {
        desktop.remove(viewComponent);
    }
    viewComponent = component;
    if (viewComponent != null) {
        GridBagConstraints constr = new GridBagConstraints();
        constr.gridx = 1;
        constr.gridy = 1;
        constr.fill = GridBagConstraints.BOTH;
        constr.weightx = 1;
        constr.weighty = 1;
        constr.anchor = GridBagConstraints.CENTER;
        Insets insets = UIManager.getInsets("nb.desktop.view.insets"); //NOI18N
        if( null != insets )
            constr.insets = insets;
        desktop.add(component, constr);
    }
    layeredPane.revalidate();
    layeredPane.repaint();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DesktopImpl.java


注:本文中的java.awt.GridBagConstraints类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。