本文整理匯總了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;
}
示例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++;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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) );
}
示例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);
}
示例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)));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}