本文整理汇总了Java中java.awt.GridBagConstraints.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java GridBagConstraints.NONE属性的具体用法?Java GridBagConstraints.NONE怎么用?Java GridBagConstraints.NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.GridBagConstraints
的用法示例。
在下文中一共展示了GridBagConstraints.NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ExtendedGridBagConstraints
public ExtendedGridBagConstraints( // 9
int intPgridX,
int intPgridY,
int intPgridWidth,
int intPgridHeight,
int intPinsideLocation,
int intPtopMargin,
int intPbottomMargin,
int intPleftMargin,
int intPrightMargin) {
this( intPgridX,
intPgridY,
intPgridWidth,
intPgridHeight,
intPinsideLocation,
0,
0,
intPtopMargin,
intPbottomMargin,
intPleftMargin,
intPrightMargin,
GridBagConstraints.NONE,
0.0F,
0.0F);
}
示例2: createBooleanOption
private JComponent createBooleanOption(OptionDescriptor option, Preferences prefs) {
JCheckBox checkBox = new JCheckBox();
org.openide.awt.Mnemonics.setLocalizedText(checkBox, option.displayName);
checkBox.setToolTipText(option.tooltip);
checkBox.addActionListener(new ActionListenerImpl(option.preferencesKey, prefs));
checkBox.setSelected(prefs.getBoolean(option.preferencesKey,
Boolean.TRUE == option.defaultValue));
prefs.putBoolean(option.preferencesKey, checkBox.isSelected());
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.NONE;
constraints.gridheight = 1;
constraints.gridwidth = 2;
constraints.gridx = 0;
constraints.gridy = row++;
constraints.weightx = 0;
constraints.weighty = 0;
add(checkBox, constraints);
return checkBox;
}
示例3: addFlagsEditor
private void addFlagsEditor(JComponent c, String displayName) {
GridBagLayout layout = (GridBagLayout)c.getLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 3, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
FlagsEditor flagsEditor = new FlagsEditor();
JLabel flagsLabel = new JLabel(displayName, JLabel.TRAILING);
flagsLabel.setVerticalAlignment(SwingConstants.TOP);
layout.setConstraints(flagsLabel, constraints);
c.add(flagsLabel);
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.fill = GridBagConstraints.BOTH;
constraints.anchor = GridBagConstraints.CENTER;
constraints.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(flagsEditor, constraints);
c.add(flagsEditor);
elements.add(flagsEditor);
flagsLabel.setLabelFor(flagsEditor);
}
示例4: addColorChooser
private void addColorChooser(JComponent c, String displayName, ColorChooser chooser) {
GridBagLayout layout = (GridBagLayout)c.getLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 3, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
JLabel label = new JLabel(displayName, JLabel.TRAILING);
layout.setConstraints(label, constraints);
c.add(label);
constraints.anchor = GridBagConstraints.WEST;
constraints.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(chooser, constraints);
c.add(chooser);
elements.add(chooser);
label.setLabelFor(chooser);
}
示例5: addLeftRightComponents
private void addLeftRightComponents(JComponent[] ComponentLeft,
JComponent[] ComponentRight,
GridBagLayout gridbag,
Container container) {
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.NORTHEAST;
int numLabels = ComponentLeft.length;
for (int i = 0; i < numLabels; i++) {
c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
c.fill = GridBagConstraints.NONE; //reset to default
c.weightx = 0.0;
c.insets = new Insets(0,10,0,0);//reset to default
container.add(ComponentLeft[i], c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0.0;
c.insets = new Insets(0,10,3,0);
container.add(ComponentRight[i], c);
}
}
示例6: addToConfigPanel
/**
* Adds a new component to the jPanelConfig panel in vertical direction.
* @param newComponent the new component
*/
private void addToConfigPanel(Component newComponent) {
int compsThere = this.getJPanelConfig().getComponentCount();
GridBagConstraints gridBagC = new GridBagConstraints();
gridBagC.gridx = 0;
gridBagC.gridy = compsThere;
gridBagC.fill = GridBagConstraints.NONE;
gridBagC.insets = new Insets(10, 10, 5, 10);
gridBagC.weightx = 1.0;
gridBagC.anchor = GridBagConstraints.WEST;
// --- Get old panel height -------------
int oldPanelHeight = this.getJPanelConfig().getHeight();
int oldPanelWidth = this.getJPanelConfig().getWidth();
// --- new Component height -------------
int newCompHeight = newComponent.getHeight();
int newCompPrefHeight = (int) newComponent.getPreferredSize().getHeight();
if (newCompPrefHeight>newCompHeight) newCompHeight = newCompPrefHeight;
int newPanelHeight = oldPanelHeight + newCompHeight + gridBagC.insets.top + gridBagC.insets.bottom + 10;
// --- Set size and add component -------
this.getJPanelConfig().setSize(new Dimension(oldPanelWidth, newPanelHeight));
this.getJPanelConfig().setPreferredSize(new Dimension(oldPanelWidth, newPanelHeight));
this.getJPanelConfig().add(newComponent, gridBagC);
this.addHorizontalSeparator();
this.getJPanelConfig().revalidate();
this.getJPanelConfig().repaint();
}
示例7: addProbability
/**
* Add a probability to an interval Panel
* If the probability is for interval B the value is displayed as 1-probability
* @param intervalPanel the intervalPanel
* @param intervalA if the probability is for interval A or B
*/
protected void addProbability(Container intervalPanel, boolean intervalA) {
JLabel probLabel = new JLabel(PROBABILITY);
JTextField probValue = new JTextField();
Double probability = (Double) current.getParameter(0).getValue();
//If the interval is interval A display value directly
//Otherwise display 1-probability
if (intervalA) {
probValue.setName(PROBABILITY_INTERVAL_A);
} else {
probability = new Double(1 - probability.doubleValue());
probValue.setName(PROBABILITY_INTERVAL_B);
}
probValue.setText(probability.toString());
probLabel.setLabelFor(probValue);
probValue.addFocusListener(new ProbabilityAdapter());
probValue.addKeyListener(new ProbabilityAdapter());
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
c.fill = GridBagConstraints.NONE; // reset to default
c.weightx = 0.0; // reset to default
c.weighty = 1.0;
intervalPanel.add(probLabel, c);
c.gridwidth = GridBagConstraints.REMAINDER; // end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
c.weighty = 1.0;
intervalPanel.add(probValue, c);
}
示例8: setWeightX
final public ExtendedGridBagConstraints setWeightX(double dblPweightX) {
if (dblPweightX >= 0) {
this.weightx = dblPweightX;
this.fill =
this.weighty > 0 ? dblPweightX > 0 ? GridBagConstraints.BOTH : GridBagConstraints.VERTICAL
: dblPweightX > 0 ? GridBagConstraints.HORIZONTAL : GridBagConstraints.NONE;
} else {
Tools.err("bad weight x value : ", dblPweightX);
}
return this;
}
示例9: getConstraints
public static GridBagConstraints getConstraints() {
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = 0.5;
c.ipadx = 150;
c.ipady = 2;
c.gridx = 0;
c.gridy = 0;
c.fill = GridBagConstraints.NONE;
c.insets = insets;
c.anchor = GridBagConstraints.LINE_START;
return (c);
}
示例10: addLabel
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);
}
示例11: setupPanel
private void setupPanel() {
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1;
gbc.insets = new Insets( 2, 0, 2, 2 );
this.setLayout( gbl );
addLabeledComponentToGBL( "Font: ", fontMenu, gbl, gbc, this );
addLabeledComponentToGBL( "Size: ", sizeField, gbl, gbc, this );
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Font Transform:",
transformMenu, gbl, gbc, this );
gbc.gridwidth = 1;
addLabeledComponentToGBL( "Range: ", rm, gbl, gbc, this );
addLabeledComponentToGBL( "Style: ", styleMenu, gbl, gbc, this );
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Graphics Transform: ",
transformMenuG2, gbl, gbc, this );
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.WEST;
addLabeledComponentToGBL( "Method: ", methodsMenu, gbl, gbc, this );
addLabeledComponentToGBL("", null, gbl, gbc, this);
gbc.anchor = GridBagConstraints.EAST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Text to use:", textMenu, gbl, gbc, this );
gbc.weightx=1;
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
addLabeledComponentToGBL("LCD contrast: ",
contrastSlider, gbl, gbc, this);
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.NONE;
addLabeledComponentToGBL("Antialiasing: ",
antiAliasMenu, gbl, gbc, this);
gbc.anchor = GridBagConstraints.EAST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL("Fractional metrics: ",
fracMetricsMenu, gbl, gbc, this);
gbc.weightx = 1;
gbc.weighty = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets( 2, 0, 0, 2 );
gbc.fill = GridBagConstraints.BOTH;
gbl.setConstraints( fp, gbc );
this.add( fp );
gbc.weighty = 0;
gbc.insets = new Insets( 0, 2, 0, 0 );
gbl.setConstraints( statusBar, gbc );
this.add( statusBar );
}
示例12: VariableTab
VariableTab(VariableList data) {
this.data = data;
list.setModel(new VariableListModel(data));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(myListener);
remove.addActionListener(myListener);
moveUp.addActionListener(myListener);
moveDown.addActionListener(myListener);
add.addActionListener(myListener);
rename.addActionListener(myListener);
field.addActionListener(myListener);
field.getDocument().addDocumentListener(myListener);
JScrollPane listPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
listPane.setPreferredSize(new Dimension(100, 100));
JPanel topPanel = new JPanel(new GridLayout(3, 1));
topPanel.add(remove);
topPanel.add(moveUp);
topPanel.add(moveDown);
JPanel fieldPanel = new JPanel();
fieldPanel.add(rename);
fieldPanel.add(add);
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gc = new GridBagConstraints();
setLayout(gb);
gc.insets = new Insets(10, 10, 0, 10);
gc.fill = GridBagConstraints.BOTH;
gc.weightx = 1.0;
gb.setConstraints(listPane, gc);
add(listPane);
gc.fill = GridBagConstraints.NONE;
gc.anchor = GridBagConstraints.PAGE_START;
gc.weightx = 0.0;
gb.setConstraints(topPanel, gc);
add(topPanel);
gc.gridwidth = GridBagConstraints.REMAINDER;
gc.gridx = 0;
gc.gridy = GridBagConstraints.RELATIVE;
gc.fill = GridBagConstraints.HORIZONTAL;
gb.setConstraints(field, gc);
field.setBorder(BorderFactory.createLineBorder(new Color(130, 135, 144)));
add(field);
gb.setConstraints(fieldPanel, gc);
add(fieldPanel);
gc.fill = GridBagConstraints.HORIZONTAL;
gb.setConstraints(error, gc);
add(error);
if (!data.isEmpty())
list.setSelectedValue(data.get(0), true);
computeEnabled();
}
示例13: sessionUI
protected void sessionUI() {
setSessionID();
//textfields needed for UI
JTextField sessionIDText = new JTextField(getSessionID());
sessionIDText.setEditable(false);
JTextArea sessionDescripText = new JTextArea(4,5);
sessionDescripText.setLineWrap(true);
JScrollPane scrollPane = new JScrollPane(sessionDescripText);
//Radio Button List
JRadioButton newFeature = new JRadioButton("New Feature");
JRadioButton bugFix = new JRadioButton("Bug Fix");
JRadioButton refactoring = new JRadioButton("Refactoring");
JRadioButton genComp = new JRadioButton("General Comprehension");
JRadioButton other = new JRadioButton("Other");
//Group the buttons
ButtonGroup radioList = new ButtonGroup();
radioList.add(newFeature);
radioList.add(bugFix);
radioList.add(refactoring);
radioList.add(genComp);
radioList.add(other);
//Add to a JPanel
JPanel radioPanel = new JPanel(new GridLayout(0, 1));
radioPanel.add(newFeature);
radioPanel.add(bugFix);
radioPanel.add(refactoring);
radioPanel.add(genComp);
radioPanel.add(other);
//Add everything to main JPanel
JPanel sessionPanel = new JPanel(); //main panel
sessionPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.NORTHWEST;
c.gridx = 0;
c.gridy = 0;
sessionPanel.add(new JLabel("Generated Session ID:"),c);
c.gridx++;
sessionPanel.add(sessionIDText,c);
c.gridx = 0;
c.gridy++;
sessionPanel.add(new JLabel("Session Purpose (select one):"),c);
c.gridx++;
sessionPanel.add(radioPanel,c);
c.gridx = 0;
c.gridy++;
sessionPanel.add(new JLabel("Enter the Session Description:"),c);
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
sessionPanel.add(scrollPane,c);
final int selection = JOptionPane.showConfirmDialog(null, sessionPanel,
"Enter the Current Session Info.",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (selection == JOptionPane.OK_OPTION) {
sessionDescrip = sessionDescripText.getText();
if (newFeature.isSelected()) {
sessionPurpose = newFeature.getText();
} else if (bugFix.isSelected()) {
sessionPurpose = bugFix.getText();
} else if (refactoring.isSelected()) {
sessionPurpose = refactoring.getText();
} else if (genComp.isSelected()) {
sessionPurpose = genComp.getText();
} else if (other.isSelected()) {
sessionPurpose = other.getText();
} else {
sessionPurpose = new String();
System.out.println("Warning! "
+ "Your Session Purpose has not been selected.");
}
hasSessionInfo = true;
}
}
示例14: createCenterPanel
@Override
protected JComponent createCenterPanel()
{
final JPanel panel = new JPanel( new GridBagLayout() );
panel.setBorder( BorderFactory.createEmptyBorder( 8, 8, 8, 8 ) );
final GridBagConstraints c = new GridBagConstraints();
int iY = 0;
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.NONE;
c.gridx = 0;
c.gridy = iY++;
c.weightx = 1;
c.weighty = 0;
c.insets = new Insets( 2, 2, 0, 0 );
panel.add( new JLabel( ManBundle.message( "type.Class.Name" ) ), c );
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = iY++;
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 0;
c.insets = new Insets( 2, 2, 5, 0 );
panel.add( _fieldName = new IdentifierTextField(), c );
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.NONE;
c.gridx = 0;
c.gridy = iY++;
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 0;
c.insets = new Insets( 2, 2, 2, 0 );
panel.add( new JLabel( ManBundle.message( "action.create.extended.type" ) ), c );
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.BOTH;
c.gridx = 0;
c.gridy = iY;
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
c.insets = new Insets( 2, 2, 0, 0 );
JComponent centerPanel = super.createCenterPanel();
panel.add( centerPanel, c );
//noinspection deprecation
_fieldName.setNextFocusableComponent( getGotoByNamePanel().getPreferredFocusedComponent() );
return panel;
}
示例15: createHeaderPanel
private Component createHeaderPanel() {
JPanel buttonPanel = new JPanel(new GridBagLayout());
buttonPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.TAB_BORDER));
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(10, 10, 10, 0);
gbc.gridx = 0;
// tutorial title
{
tutorialNameLabel = new JLabel(" ");
buttonPanel.add(tutorialNameLabel, gbc);
}
// filler
{
gbc.gridx += 1;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
buttonPanel.add(new JLabel(), gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0;
}
// back to tutorials button
{
gbc.gridx += 1;
gbc.insets = new Insets(10, 0, 10, 0);
JLabel backToTutorialsIcon = new JLabel(String.format(ICON_TEMPLATE, LINK_COLOR_HEX, Ionicon.HOME.getHtml()));
buttonPanel.add(backToTutorialsIcon, gbc);
LinkLocalButton backToTutorialsButton = new LinkLocalButton(new ResourceAction("tutorials.view_all_tutorials") {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
try {
StartupDialogRegistry.INSTANCE.showStartupDialog(ToolbarButton.TUTORIAL);
} catch (NoStartupDialogRegistreredException e1) {
SwingTools.showVerySimpleErrorMessage("tutorials_not_available");
}
}
});
HTMLEditorKit htmlKit = (HTMLEditorKit) backToTutorialsButton.getEditorKit();
htmlKit.getStyleSheet().addRule(LINK_STYLE);
gbc.gridx += 1;
gbc.insets = new Insets(10, 0, 10, 10);
buttonPanel.add(backToTutorialsButton, gbc);
}
return buttonPanel;
}