本文整理汇总了Java中java.awt.GridLayout.setHgap方法的典型用法代码示例。如果您正苦于以下问题:Java GridLayout.setHgap方法的具体用法?Java GridLayout.setHgap怎么用?Java GridLayout.setHgap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.GridLayout
的用法示例。
在下文中一共展示了GridLayout.setHgap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCapabilitiesPanel
import java.awt.GridLayout; //导入方法依赖的package包/类
public static JPanel createCapabilitiesPanel(Operator operator) {
CapabilityProvider capabilityProvider = (CapabilityProvider) operator;
int length = OperatorCapability.values().length;
GridLayout layout = new GridLayout(length / 2, 2);
layout.setHgap(GAP);
layout.setVgap(GAP);
JPanel capabilitiesPanel = new JPanel(layout);
for (OperatorCapability capability : OperatorCapability.values()) {
JLabel capabilityLabel = new JLabel(capability.getDescription());
try {
if (capabilityProvider.supportsCapability(capability)) {
capabilityLabel.setIcon(SwingTools.createIcon("16/ok.png"));
} else {
capabilityLabel.setIcon(SwingTools.createIcon("16/error.png"));
}
} catch (Exception e) {
break;
}
capabilitiesPanel.add(capabilityLabel);
}
return capabilitiesPanel;
}
示例2: InputPanel
import java.awt.GridLayout; //导入方法依赖的package包/类
public InputPanel(int size){
grid = new JTextField[size][GRID_W];
this.setBackground(Color.DARK_GRAY);
GridLayout l = new GridLayout(size+1, GRID_W);
l.setHgap(5);
l.setVgap(5);
this.setLayout(l);
for(JLabel lbl : HEADLINES){
lbl.setForeground(Color.LIGHT_GRAY);
lbl.setHorizontalAlignment(JLabel.CENTER);
this.add(lbl);
}
for(int i = 0; i < grid.length; i++){
JLabel jlbl = new JLabel("10.1.1." + (i+1));
jlbl.setForeground(Color.WHITE);
this.add(jlbl);
for(int j = 0; j < grid[i].length; j++)
this.add(grid[i][j] = new JTextField());
}
}
示例3: initialize
import java.awt.GridLayout; //导入方法依赖的package包/类
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
double[][] size = {{5, TableLayout.FILL, 5},
{5, TableLayout.FILL, 5}};
this.setLayout(new TableLayout(size));
final GridLayout gridLayout3 = new GridLayout();
JPanel child = new JPanel(gridLayout3);
this.setSize(351, 105);
gridLayout3.setRows(3);
gridLayout3.setColumns(2);
gridLayout3.setHgap(5);
gridLayout3.setVgap(5);
child.add(getJRadioButton(), null);
child.add(getJRadioButton1(), null);
child.add(getJRadioButton2(), null);
child.add(getJRadioButton3(), null);
child.add(getJRadioButton4(), null);
child.add(getJTextField(), null);
this.add(child, "1,1");
}
示例4: PopupPane
import java.awt.GridLayout; //导入方法依赖的package包/类
public PopupPane() {
listComponents = new HashSet<ListComponent>();
view = new JPanel();
GridLayout grid = new GridLayout(0, 1);
grid.setHgap(0);
grid.setVgap(0);
view.setLayout(grid);
view.setBorder(BorderFactory.createEmptyBorder());
setName("progresspopup"); //NOI18N
setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
setViewportView(view);
setFocusable(true);
setRequestFocusEnabled(true);
Action down = new MoveDownAction();
getActionMap().put("Move-Down", down);
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Move-Down");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Move-Down");
Action up = new MoveUpAction();
getActionMap().put("Move-Up", up);
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "Move-Up");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "Move-Up");
Action cancel = new CancelAction();
getActionMap().put("Cancel-Task", cancel);
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "Cancel-Task");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "Cancel-Task");
Action select = new SelectAction();
getActionMap().put("select-task", select);
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "select-task");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "select-task");
setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
示例5: buildIndianNationTypeDetail
import java.awt.GridLayout; //导入方法依赖的package包/类
/**
* Builds the details panel for the given nation type.
*
* @param nationType - the IndianNationType
* @param panel the panel to use
*/
private void buildIndianNationTypeDetail(IndianNationType nationType,
JPanel panel) {
List<RandomChoice<UnitType>> skills = nationType.getSkills();
panel.setLayout(new MigLayout("wrap 2, gapx 20", "", ""));
JLabel name = Utility.localizedHeaderLabel(nationType, FontLibrary.FontSize.SMALL);
panel.add(name, "span, align center, wrap 40");
panel.add(Utility.localizedLabel("colopedia.nationType.aggression"));
panel.add(Utility.localizedLabel("colopedia.nationType."
+ nationType.getAggression().getKey()));
panel.add(Utility.localizedLabel("colopedia.nationType.settlementNumber"));
panel.add(Utility.localizedLabel("colopedia.nationType."
+ nationType.getNumberOfSettlements().getKey()));
panel.add(Utility.localizedLabel("colopedia.nationType.typeOfSettlements"));
panel.add(new JLabel(Messages.getName(nationType.getCapitalType()),
new ImageIcon(getImageLibrary().getSettlementImage(nationType.getCapitalType())),
SwingConstants.CENTER));
List<String> regionNames = new ArrayList<>();
for (String regionName : nationType.getRegions()) {
regionNames.add(Messages.getName(regionName));
}
panel.add(Utility.localizedLabel("colopedia.nationType.regions"));
panel.add(new JLabel(join(", ", regionNames)));
panel.add(Utility.localizedLabel("colopedia.nationType.skills"), "top, newline 20");
GridLayout gridLayout = new GridLayout(0, 2);
gridLayout.setHgap(10);
JPanel unitPanel = new JPanel(gridLayout);
unitPanel.setOpaque(false);
for (RandomChoice<UnitType> choice : skills) {
unitPanel.add(getUnitButton(choice.getObject()));
}
panel.add(unitPanel);
}
示例6: showPSPAttrs
import java.awt.GridLayout; //导入方法依赖的package包/类
/**
* Displays PSP attribute information, including total time, total defects injected, and
* total defects removed. This information is automatically updated as the user completes
* phases/tasks and is thus not editable by the user.
*/
public void showPSPAttrs() {
setSize(getWidth(), getHeight() + 300);
GridLayout gridLayout = new GridLayout(0, 2);
gridLayout.setHgap(10);
gridLayout.setVgap(10);
pspPanel.setLayout(gridLayout);
pspPanel.setBorder(new EtchedBorder());
pspPanel.setBackground(Color.WHITE);
// add combo box
// pspPanel.add(phaseLabel);
// pspPanel.add(currentPhase);
// configure labels and text fields
timeLabel.setText("Total Time (min)");
defectsInjectedLabel.setText("Total Defects Injected");
defectsRemovedLabel.setText("Total Defects Removed");
totalLocCountLabel.setText(Local.getString("Total LOC"));
// programSizeLabel.setText("Total LOC");
defectLocRatioLabel.setText(Local.getString("Inj. Defects / LOC"));
totalTime.setEnabled(false);
totalDefectsInjected.setEnabled(false);
totalDefectsRemoved.setEnabled(false);
totalLocCountField.setEnabled(false);
defectLocRatioField.setEnabled(false);
// programSize.setEnabled(false);
estimatedTimeLabel.setText("Estimated Time (min)");
estimatedSizeLabel.setText("Estimated LOC");
// add labels
pspPanel.add(estimatedTimeLabel);
pspPanel.add(estimatedTime);
pspPanel.add(estimatedSizeLabel);
pspPanel.add(estimatedSize);
pspPanel.add(timeLabel);
pspPanel.add(totalTime);
pspPanel.add(defectsInjectedLabel);
pspPanel.add(totalDefectsInjected);
pspPanel.add(defectsRemovedLabel);
pspPanel.add(totalDefectsRemoved);
pspPanel.add(totalLocCountLabel);
pspPanel.add(totalLocCountField);
//pspPanel.add(programSizeLabel);
//pspPanel.add(programSize);
pspPanel.add(defectLocRatioLabel);
pspPanel.add(defectLocRatioField);
// add panel
gbc = new GridBagConstraints();
gbc.gridx = 0; gbc.gridy = 2;
gbc.insets = new Insets(5, 10, 5, 10);
gbc.anchor = GridBagConstraints.SOUTH;
getContentPane().remove(bottomPanel); // remove bottom panel
getContentPane().add(pspPanel, gbc);
addBottomPanel(3); // re-add bottom panel
}