There are 67 code examples for java.awt.GridBagConstraints.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: ReportDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: SelectArtyAutoHitHexDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: StatusBarPhaseDisplay.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Sets up the status bar with toggle buttons for the mek display and map.
 */
protected void setupStatusBar(String defStatus){
  panStatus=new Panel();
  labStatus=new Label(defStatus,Label.CENTER);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panStatus.setLayout(gridbag);
  c.insets=new Insets(0,1,0,1);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=1.0;
  c.weighty=0.0;
  gridbag.setConstraints(labStatus,c);
  panStatus.add(labStatus);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: BoardEditor.java (Click to view .java file)

Method Code:
vote
like

private void addBag(final Component comp,final GridBagLayout gridbag,final GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: GameOptionsDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOkay.addActionListener(this);
  butCancel.addActionListener(this);
  butDefaults.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.insets=new Insets(5,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  c.anchor=GridBagConstraints.EAST;
  gridbag.setConstraints(butOkay,c);
  panButtons.add(butOkay);
  c.anchor=GridBagConstraints.WEST;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  gridbag.setConstraints(butDefaults,c);
  panButtons.add(butDefaults);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: DeploymentDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: RandomMapDialog.java (Click to view .java file)

Method Code:
vote
like

private void addSeparator(SimpleLine sl){
  GridBagConstraints c=new GridBagConstraints();
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.insets=new Insets(2,0,2,0);
  gridbag.setConstraints(sl,c);
  panOptions.add(sl);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: AlertDialog.java (Click to view .java file)

Method Code:
vote
like

public AlertDialog(Frame parent,String title,String message){
  super(parent,title,true);
  labMessage=new AdvancedLabel(message);
  butOkay.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,10,10,10);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  ScrollPane scrollPane=new ScrollPane();
  scrollPane.add(labMessage);
  scrollPane.setSize(400,300);
  gridbag.setConstraints(scrollPane,c);
  add(scrollPane);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  gridbag.setConstraints(butOkay,c);
  add(butOkay);
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      setVisible(false);
    }
  }
);
  pack();
  Dimension size=getSize();
  boolean updateSize=false;
  if (size.width < GUIPreferences.getInstance().getMinimumSizeWidth()) {
    size.width=GUIPreferences.getInstance().getMinimumSizeWidth();
  }
  if (size.height < GUIPreferences.getInstance().getMinimumSizeHeight()) {
    size.height=GUIPreferences.getInstance().getMinimumSizeHeight();
  }
  if (updateSize) {
    setSize(size);
    size=getSize();
  }
  setResizable(false);
  setLocationRelativeTo(parent);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: FiringDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: MovementDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: ChatLounge.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Sets up the starting positions panel
 */
private void setupStarts(){
  labStarts=new Label(Messages.getString("ChatLounge.labStarts"),Label.CENTER);
  lisStarts=new List(5);
  lisStarts.addActionListener(this);
  butChangeStart=new Button(Messages.getString("ChatLounge.butChangeStart"));
  butChangeStart.addActionListener(this);
  panStarts=new Panel();
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panStarts.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labStarts,c);
  panStarts.add(labStarts);
  c.weightx=1.0;
  c.weighty=1.0;
  gridbag.setConstraints(lisStarts,c);
  panStarts.add(lisStarts);
  c.weightx=1.0;
  c.weighty=0.0;
  gridbag.setConstraints(butChangeStart,c);
  panStarts.add(butChangeStart);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: ClientGUI.java (Click to view .java file)

Method Code:
vote
like

protected void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: AimedShotDialog.java (Click to view .java file)

Method Code:
vote
like

public AimedShotDialog(Frame parent,String title,String message,String[] choices,boolean[] enabled,int selectedIndex,ItemListener il,ActionListener al){
  super(parent,title,false);
  super.setResizable(false);
  this.enabled=enabled;
  GridBagLayout gridbag=new GridBagLayout();
  setLayout(gridbag);
  GridBagConstraints c=new GridBagConstraints();
  Label labMessage=new Label(message,Label.LEFT);
  c.weightx=1.0;
  c.weighty=1.0;
  c.gridwidth=0;
  c.anchor=GridBagConstraints.WEST;
  gridbag.setConstraints(labMessage,c);
  add(labMessage);
  CheckboxGroup radioGroup=new CheckboxGroup();
  checkboxes=new IndexedCheckbox[choices.length];
  for (int i=0; i < choices.length; i++) {
    boolean even=(i & 1) == 0;
    checkboxes[i]=new IndexedCheckbox(choices[i],(i == selectedIndex),radioGroup,i);
    checkboxes[i].addItemListener(il);
    checkboxes[i].setEnabled(enabled[i]);
    c.gridwidth=even ? 1 : GridBagConstraints.REMAINDER;
    c.anchor=GridBagConstraints.WEST;
    gridbag.setConstraints(checkboxes[i],c);
    add(checkboxes[i]);
  }
  butNoAim.addActionListener(al);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.insets=new Insets(5,0,5,0);
  c.anchor=GridBagConstraints.CENTER;
  gridbag.setConstraints(butNoAim,c);
  add(butNoAim);
  butNoAim.requestFocus();
  pack();
  setLocationRelativeTo(parent);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: BoardComponent.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates new BoardComponent 
 */
public BoardComponent(BoardView1 bv){
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(0,0,0,0);
  c.weightx=1.0;
  c.weighty=1.0;
  c.gridwidth=1;
  gridbag.setConstraints(bv,c);
  add(bv);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(scrVertical,c);
  add(scrVertical);
  c.gridwidth=1;
  gridbag.setConstraints(scrHorizontal,c);
  add(scrHorizontal);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(panBlank,c);
  add(panBlank);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: ManeuverChoiceDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOK.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOK,c);
  panButtons.add(butOK);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: MegaMekGUI.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  frame.add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: MineDensityDialog.java (Click to view .java file)

Method Code:
vote
like

public MineDensityDialog(Frame p){
  super(p,Messages.getString("MineDensityDialog.title"),true);
  super.setResizable(false);
  butOk.addActionListener(this);
  choDensity.removeAll();
  for (int i=5; i < 35; i=i + 5) {
    choDensity.add(Integer.toString(i));
  }
  choDensity.select(0);
  setLayout(gridbag);
  c.fill=GridBagConstraints.VERTICAL;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labDensity,c);
  add(labDensity);
  c.fill=GridBagConstraints.BOTH;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(choDensity,c);
  add(choDensity);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(butOk,c);
  add(butOk);
  pack();
  setLocation(p.getLocation().x + p.getSize().width / 2 - getSize().width / 2,p.getLocation().y + p.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: DeployMinefieldDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: StartingPositionDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOkay.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.insets=new Insets(5,5,0,0);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOkay,c);
  panButtons.add(butOkay);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: BombPayloadDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOK.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOK,c);
  panButtons.add(butOK);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: ChoiceDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOK.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOK,c);
  panButtons.add(butOK);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: CustomMechDialog.java (Click to view .java file)

Method Code:
vote
like

private void addOption(IOption option,GridBagLayout gridbag,GridBagConstraints c,boolean editable){
  DialogOptionComponent optionComp=new DialogOptionComponent(this,option,editable);
  if (option.getName().equals("weapon_specialist")) {
    optionComp.addValue(Messages.getString("CustomMechDialog.None"));
    TreeSet<String> uniqueWeapons=new TreeSet<String>();
    for (int i=0; i < entity.getWeaponList().size(); i++) {
      Mounted m=entity.getWeaponList().get(i);
      uniqueWeapons.add(m.getName());
    }
    for (    String name : uniqueWeapons) {
      optionComp.addValue(name);
    }
    optionComp.setSelected(option.stringValue());
  }
  gridbag.setConstraints(optionComp,c);
  panOptions.add(optionComp);
  optionComps.addElement(optionComp);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: BoardNewDialog.java (Click to view .java file)

Method Code:
vote
like

public BoardNewDialog(Frame frame,String[] hexList,int hexSelected){
  super(frame,Messages.getString("BoardEditor.SetDimentions"),true);
  xvalue=0;
  yvalue=0;
  labWidth=new Label(Messages.getString("BoardEditor.labWidth"),Label.RIGHT);
  labHeight=new Label(Messages.getString("BoardEditor.labHeight"),Label.RIGHT);
  texWidth=new TextField("16",2);
  texHeight=new TextField("17",2);
  butOkay=new Button(Messages.getString("Okay"));
  butOkay.setActionCommand("done");
  butOkay.addActionListener(this);
  butOkay.setSize(80,24);
  butCancel=new Button(Messages.getString("Cancel"));
  butCancel.setActionCommand("cancel");
  butCancel.addActionListener(this);
  butCancel.setSize(80,24);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  setLayout(gridbag);
  c.fill=GridBagConstraints.NONE;
  c.weightx=0.0;
  c.weighty=0.0;
  c.insets=new Insets(5,5,1,1);
  gridbag.setConstraints(labWidth,c);
  add(labWidth);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(texWidth,c);
  add(texWidth);
  c.gridwidth=GridBagConstraints.RELATIVE;
  gridbag.setConstraints(labHeight,c);
  add(labHeight);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(texHeight,c);
  add(texHeight);
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=GridBagConstraints.RELATIVE;
  gridbag.setConstraints(butOkay,c);
  add(butOkay);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  add(butCancel);
  pack();
  setResizable(false);
  setLocationRelativeTo(frame);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: CustomInitiativeDialog.java (Click to view .java file)

Method Code:
vote
like

public CustomInitiativeDialog(ClientGUI cl){
  super(cl.frame,Messages.getString("CustomInitiativeDialog.title"),true);
  m_client=cl.getClient();
  updateValues();
  GridBagLayout layout=new GridBagLayout();
  m_pParameters.setLayout(layout);
  GridBagConstraints constraints=new GridBagConstraints();
  constraints.weightx=1.0;
  constraints.weighty=1.0;
  constraints.anchor=GridBagConstraints.LINE_START;
  layout.setConstraints(m_labConstant,constraints);
  m_pParameters.add(m_labConstant);
  constraints.gridwidth=GridBagConstraints.REMAINDER;
  layout.setConstraints(m_constant,constraints);
  m_pParameters.add(m_constant);
  constraints.gridwidth=GridBagConstraints.REMAINDER;
  m_pButtons.setLayout(new FlowLayout(FlowLayout.CENTER));
  m_pButtons.add(m_bOK);
  m_bOK.addActionListener(this);
  m_pButtons.add(m_bCancel);
  m_bCancel.addActionListener(this);
  setLayout(new BorderLayout());
  add(m_pButtons,BorderLayout.SOUTH);
  add(m_pParameters,BorderLayout.WEST);
  validate();
  pack();
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: VibrabombSettingDialog.java (Click to view .java file)

Method Code:
vote
like

public VibrabombSettingDialog(Frame p){
  super(p,Messages.getString("VibrabombSettingDialog.title"),true);
  super.setResizable(false);
  frame=p;
  butOk.addActionListener(this);
  Label labMessage=new Label(Messages.getString("VibrabombSettingDialog.selectSetting"));
  setLayout(gridbag);
  c.fill=GridBagConstraints.VERTICAL;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labMessage,c);
  add(labMessage);
  c.fill=GridBagConstraints.BOTH;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(fldSetting,c);
  add(fldSetting);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(butOk,c);
  add(butOk);
  pack();
  setLocation(p.getLocation().x + p.getSize().width / 2 - getSize().width / 2,p.getLocation().y + p.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: SeaMineDepthDialog.java (Click to view .java file)

Method Code:
vote
like

public SeaMineDepthDialog(Frame p,int totalDepth){
  super(p,Messages.getString("SeaMineDepthDialog.title"),true);
  super.setResizable(false);
  butOk.addActionListener(this);
  choDepth.removeAll();
  for (int i=0; i < (totalDepth + 1); i++) {
    choDepth.add(Integer.toString(i));
  }
  choDepth.select(0);
  setLayout(gridbag);
  c.fill=GridBagConstraints.VERTICAL;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labDepth,c);
  add(labDepth);
  c.fill=GridBagConstraints.BOTH;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(choDepth,c);
  add(choDepth);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(butOk,c);
  add(butOk);
  pack();
  setLocation(p.getLocation().x + p.getSize().width / 2 - getSize().width / 2,p.getLocation().y + p.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: RandomSkillDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOkay.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.insets=new Insets(5,5,0,0);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOkay,c);
  panButtons.add(butOkay);
  c.gridwidth=1;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
  c.gridwidth=1;
  gridbag.setConstraints(labelPlayer,c);
  panButtons.add(labelPlayer);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(chPlayer,c);
  panButtons.add(chPlayer);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: TargetingPhaseDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: PhysicalDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(Component comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: ConfirmDialog.java (Click to view .java file)

Method Code:
vote
like

private void addInputs(){
  int y=2;
  c.gridheight=1;
  if (useCheckbox) {
    botherCheckbox=new Checkbox(Messages.getString("ConfirmDialog.dontBother"));
    c.gridy=y++;
    gridbag.setConstraints(botherCheckbox,c);
    add(botherCheckbox);
  }
  butYes.addActionListener(this);
  butNo.addActionListener(this);
  GridBagLayout buttonGridbag=new GridBagLayout();
  GridBagConstraints bc=new GridBagConstraints();
  panButtons.setLayout(buttonGridbag);
  bc.insets=new Insets(5,5,5,5);
  bc.ipadx=20;
  bc.ipady=5;
  buttonGridbag.setConstraints(butYes,bc);
  panButtons.add(butYes);
  buttonGridbag.setConstraints(butNo,bc);
  panButtons.add(butNo);
  c.gridy=y;
  gridbag.setConstraints(panButtons,c);
  add(panButtons);
}
 

Project Name: megamek Package: megamek.client.ui.AWT

Source Code: BoardSelectionDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butUpdate.addActionListener(this);
  butOkay.addActionListener(this);
  butCancel.addActionListener(this);
  butRandomMap.addActionListener(this);
  butPreview.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.insets=new Insets(5,5,0,0);
  c.weightx=0.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butUpdate,c);
  panButtons.add(butUpdate);
  gridbag.setConstraints(butRandomMap,c);
  panButtons.add(butRandomMap);
  gridbag.setConstraints(butPreview,c);
  panButtons.add(butPreview);
  c.weightx=1.0;
  c.weighty=1.0;
  gridbag.setConstraints(labButtonSpace,c);
  panButtons.add(labButtonSpace);
  c.weightx=0.0;
  c.weighty=1.0;
  gridbag.setConstraints(butOkay,c);
  panButtons.add(butOkay);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: MegaMekGUI.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  frame.getContentPane().add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: PortraitChoiceDialog.java (Click to view .java file)

Method Code:
vote
like

public PortraitPanel(){
  GridBagConstraints c=new GridBagConstraints();
  lblImage=new JLabel();
  setLayout(new GridBagLayout());
  c=new GridBagConstraints();
  c.gridx=0;
  c.gridy=0;
  c.fill=GridBagConstraints.BOTH;
  c.weightx=1.0;
  c.weighty=1.0;
  add(lblImage,c);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: MineDensityDialog.java (Click to view .java file)

Method Code:
vote
like

public MineDensityDialog(JFrame p){
  super(p,Messages.getString("MineDensityDialog.title"),true);
  super.setResizable(false);
  butOk.addActionListener(this);
  choDensity.removeAllItems();
  for (int i=5; i < 35; i=i + 5) {
    choDensity.addItem(Integer.toString(i));
  }
  choDensity.setSelectedIndex(0);
  getContentPane().setLayout(gridbag);
  c.fill=GridBagConstraints.VERTICAL;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labDensity,c);
  getContentPane().add(labDensity);
  c.fill=GridBagConstraints.BOTH;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(choDensity,c);
  getContentPane().add(choDensity);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(butOk,c);
  getContentPane().add(butOk);
  pack();
  setLocation(p.getLocation().x + p.getSize().width / 2 - getSize().width / 2,p.getLocation().y + p.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: SeaMineDepthDialog.java (Click to view .java file)

Method Code:
vote
like

public SeaMineDepthDialog(JFrame p,int totalDepth){
  super(p,Messages.getString("MineDensityDialog.title"),true);
  super.setResizable(false);
  butOk.addActionListener(this);
  choDepth.removeAllItems();
  for (int i=0; i < (totalDepth + 1); i++) {
    choDepth.addItem(Integer.toString(i));
  }
  choDepth.setSelectedIndex(0);
  getContentPane().setLayout(gridbag);
  c.fill=GridBagConstraints.VERTICAL;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labDepth,c);
  getContentPane().add(labDepth);
  c.fill=GridBagConstraints.BOTH;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(choDepth,c);
  getContentPane().add(choDepth);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(butOk,c);
  getContentPane().add(butOk);
  pack();
  setLocation(p.getLocation().x + p.getSize().width / 2 - getSize().width / 2,p.getLocation().y + p.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: BombPayloadDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOK.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOK,c);
  panButtons.add(butOK);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: BoardNewDialog.java (Click to view .java file)

Method Code:
vote
like

BoardNewDialog(JFrame frame){
  super(frame,Messages.getString("BoardEditor.SetDimentions"),true);
  xvalue=0;
  yvalue=0;
  labWidth=new JLabel(Messages.getString("BoardEditor.labWidth"),SwingConstants.RIGHT);
  labHeight=new JLabel(Messages.getString("BoardEditor.labHeight"),SwingConstants.RIGHT);
  texWidth=new JTextField("16",2);
  texHeight=new JTextField("17",2);
  butOkay=new JButton(Messages.getString("Okay"));
  butOkay.setActionCommand("done");
  butOkay.addActionListener(this);
  butOkay.setSize(80,24);
  butCancel=new JButton(Messages.getString("Cancel"));
  butCancel.setActionCommand("cancel");
  butCancel.addActionListener(this);
  butCancel.setSize(80,24);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  getContentPane().setLayout(gridbag);
  c.fill=GridBagConstraints.NONE;
  c.weightx=0.0;
  c.weighty=0.0;
  c.insets=new Insets(5,5,1,1);
  gridbag.setConstraints(labWidth,c);
  getContentPane().add(labWidth);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(texWidth,c);
  getContentPane().add(texWidth);
  c.gridwidth=GridBagConstraints.RELATIVE;
  gridbag.setConstraints(labHeight,c);
  getContentPane().add(labHeight);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(texHeight,c);
  getContentPane().add(texHeight);
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=GridBagConstraints.RELATIVE;
  gridbag.setConstraints(butOkay,c);
  getContentPane().add(butOkay);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  getContentPane().add(butCancel);
  pack();
  setResizable(false);
  setLocation(frame.getLocation().x + frame.getSize().width / 2 - getSize().width / 2,frame.getLocation().y + frame.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: AimedShotDialog.java (Click to view .java file)

Method Code:
vote
like

public AimedShotDialog(JFrame parent,String title,String message,String[] choices,boolean[] enabled,int selectedIndex,ItemListener il,ActionListener al){
  super(parent,title,false);
  super.setResizable(false);
  boxEnabled=enabled;
  GridBagLayout gridbag=new GridBagLayout();
  getContentPane().setLayout(gridbag);
  GridBagConstraints c=new GridBagConstraints();
  JLabel labMessage=new JLabel(message,SwingConstants.LEFT);
  c.weightx=1.0;
  c.weighty=1.0;
  c.gridwidth=0;
  c.anchor=GridBagConstraints.WEST;
  gridbag.setConstraints(labMessage,c);
  getContentPane().add(labMessage);
  ButtonGroup radioGroup=new ButtonGroup();
  checkboxes=new IndexedCheckbox[choices.length];
  for (int i=0; i < choices.length; i++) {
    boolean even=(i & 1) == 0;
    checkboxes[i]=new IndexedCheckbox(choices[i],i == selectedIndex,radioGroup,i);
    checkboxes[i].addItemListener(il);
    checkboxes[i].setEnabled(enabled[i]);
    c.gridwidth=even ? 1 : GridBagConstraints.REMAINDER;
    c.anchor=GridBagConstraints.WEST;
    gridbag.setConstraints(checkboxes[i],c);
    add(checkboxes[i]);
  }
  butNoAim.addActionListener(al);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.insets=new Insets(5,0,5,0);
  c.anchor=GridBagConstraints.CENTER;
  gridbag.setConstraints(butNoAim,c);
  add(butNoAim);
  butNoAim.requestFocus();
  pack();
  setLocation(parent.getLocation().x + parent.getSize().width / 2 - getSize().width / 2,parent.getLocation().y + parent.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: ManeuverChoiceDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOK.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOK,c);
  panButtons.add(butOK);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: MovementDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: StatusBarPhaseDisplay.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Sets up the status bar with toggle buttons for the mek display and map.
 */
protected void setupStatusBar(String defStatus){
  panStatus=new JPanel();
  labStatus=new JLabel(defStatus,SwingConstants.CENTER);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panStatus.setLayout(gridbag);
  c.insets=new Insets(0,1,0,1);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=1.0;
  c.weighty=0.0;
  gridbag.setConstraints(labStatus,c);
  panStatus.add(labStatus);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: VibrabombSettingDialog.java (Click to view .java file)

Method Code:
vote
like

public VibrabombSettingDialog(JFrame p){
  super(p,Messages.getString("VibrabombSettingDialog.title"),true);
  super.setResizable(false);
  frame=p;
  butOk.addActionListener(this);
  JLabel labMessage=new JLabel(Messages.getString("VibrabombSettingDialog.selectSetting"));
  getContentPane().setLayout(gridbag);
  c.fill=GridBagConstraints.VERTICAL;
  c.insets=new Insets(1,1,1,1);
  c.weightx=1.0;
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(labMessage,c);
  getContentPane().add(labMessage);
  c.fill=GridBagConstraints.BOTH;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(fldSetting,c);
  getContentPane().add(fldSetting);
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.weightx=0.0;
  c.weighty=0.0;
  gridbag.setConstraints(butOk,c);
  getContentPane().add(butOk);
  pack();
  setLocation(p.getLocation().x + p.getSize().width / 2 - getSize().width / 2,p.getLocation().y + p.getSize().height / 2 - getSize().height / 2);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: BoardEditor.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: DeployMinefieldDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: ChatLounge.java (Click to view .java file)

Method Code:
vote
like

public MekInfo(){
  lblImage=new JLabel();
  lblLoad=new JLabel();
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  setLayout(gridbag);
  c.fill=GridBagConstraints.NONE;
  c.insets=new Insets(1,1,1,1);
  c.gridx=0;
  c.gridy=0;
  c.weightx=0.0;
  c.weighty=0.0;
  c.gridwidth=1;
  c.gridheight=1;
  c.anchor=GridBagConstraints.CENTER;
  gridbag.setConstraints(lblLoad,c);
  add(lblLoad);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(1,1,1,1);
  c.gridx=1;
  c.gridy=0;
  c.weightx=1.0;
  c.weighty=1.0;
  c.gridwidth=1;
  c.gridheight=1;
  c.anchor=GridBagConstraints.NORTHWEST;
  gridbag.setConstraints(lblImage,c);
  add(lblImage);
  lblImage.setBorder(BorderFactory.createEmptyBorder());
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: PhysicalDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: TargetingPhaseDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: StartingPositionDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOkay.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.insets=new Insets(5,5,0,0);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOkay,c);
  panButtons.add(butOkay);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: RandomMapDialog.java (Click to view .java file)

Method Code:
vote
like

private void addSeparator(SimpleLine sl){
  GridBagConstraints c=new GridBagConstraints();
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.anchor=GridBagConstraints.CENTER;
  c.insets=new Insets(2,0,2,0);
  gridbag.setConstraints(sl,c);
  panOptions.add(sl);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: DeploymentDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: CustomMechDialog.java (Click to view .java file)

Method Code:
vote
like

private void addOption(IOption option,GridBagLayout gridbag,GridBagConstraints c,boolean editable){
  DialogOptionComponent optionComp=new DialogOptionComponent(this,option,editable);
  if ("weapon_specialist".equals(option.getName())) {
    optionComp.addValue(Messages.getString("CustomMechDialog.None"));
    TreeSet<String> uniqueWeapons=new TreeSet<String>();
    for (int i=0; i < entity.getWeaponList().size(); i++) {
      Mounted m=entity.getWeaponList().get(i);
      uniqueWeapons.add(m.getName());
    }
    for (    String name : uniqueWeapons) {
      optionComp.addValue(name);
    }
    optionComp.setSelected(option.stringValue());
  }
  if ("specialist".equals(option.getName())) {
    optionComp.addValue(Pilot.SPECIAL_NONE);
    optionComp.addValue(Pilot.SPECIAL_LASER);
    optionComp.addValue(Pilot.SPECIAL_BALLISTIC);
    optionComp.addValue(Pilot.SPECIAL_MISSILE);
    optionComp.setSelected(option.stringValue());
  }
  gridbag.setConstraints(optionComp,c);
  panOptions.add(optionComp);
  optionComps.add(optionComp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: ConfirmDialog.java (Click to view .java file)

Method Code:
vote
like

private void addInputs(){
  int y=2;
  c.gridheight=1;
  if (useCheckbox) {
    botherCheckbox=new JCheckBox(Messages.getString("ConfirmDialog.dontBother"));
    c.gridy=y++;
    gridbag.setConstraints(botherCheckbox,c);
    getContentPane().add(botherCheckbox);
  }
  GridBagLayout buttonGridbag=new GridBagLayout();
  GridBagConstraints bc=new GridBagConstraints();
  panButtons.setLayout(buttonGridbag);
  bc.insets=new Insets(5,5,5,5);
  bc.ipadx=20;
  bc.ipady=5;
  buttonGridbag.setConstraints(butYes,bc);
  panButtons.add(butYes);
  buttonGridbag.setConstraints(butNo,bc);
  panButtons.add(butNo);
  c.gridy=y;
  gridbag.setConstraints(panButtons,c);
  getContentPane().add(panButtons);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: MapDimensionsDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOkay.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.insets=new Insets(1,1,1,1);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.weightx=0.0;
  c.weighty=0.0;
  c.gridx=0;
  c.gridy=0;
  c.gridwidth=1;
  c.gridheight=1;
  gridbag.setConstraints(butOkay,c);
  panButtons.add(butOkay);
  c.insets=new Insets(1,1,1,1);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.weightx=0.0;
  c.weighty=0.0;
  c.gridx=1;
  c.gridy=0;
  c.gridwidth=1;
  c.gridheight=1;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: MechViewPanel.java (Click to view .java file)

Method Code:
vote
like

public MechViewPanel(){
  setBackground(Color.WHITE);
  icon=null;
  txtMek=new JTextPane();
  ReportDisplay.setupStylesheet(txtMek);
  txtMek.setText("");
  txtMek.setEditable(false);
  txtMek.setBorder(null);
  txtMek.setPreferredSize(new Dimension(WIDTH,HEIGHT));
  lblMek=new JLabel();
  lblMek.setText("");
  lblMek.setVerticalAlignment(SwingConstants.TOP);
  scrMek=new JScrollPane(txtMek);
  scrMek.setBorder(null);
  scrMek.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  scrMek.setPreferredSize(new Dimension(WIDTH,HEIGHT));
  scrMek.setMinimumSize(new Dimension(WIDTH,HEIGHT));
  GridBagConstraints c;
  GridBagLayout gridbag=new GridBagLayout();
  setLayout(gridbag);
  c=new GridBagConstraints();
  c.gridx=0;
  c.gridy=0;
  c.fill=GridBagConstraints.BOTH;
  c.anchor=GridBagConstraints.NORTHWEST;
  c.weightx=0.0;
  c.weighty=1.0;
  gridbag.setConstraints(scrMek,c);
  add(scrMek);
  c.insets=new Insets(20,20,20,20);
  c.gridx=1;
  c.gridy=0;
  c.fill=GridBagConstraints.BOTH;
  c.anchor=GridBagConstraints.NORTHWEST;
  c.weightx=1.0;
  c.weighty=1.0;
  gridbag.setConstraints(lblMek,c);
  add(lblMek);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: SelectArtyAutoHitHexDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: FiringDisplay.java (Click to view .java file)

Method Code:
vote
like

private void addBag(JComponent comp,GridBagLayout gridbag,GridBagConstraints c){
  gridbag.setConstraints(comp,c);
  add(comp);
  comp.addKeyListener(this);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: CamoChoiceDialog.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates new form CamoPanel 
 */
public CamoPanel(){
  GridBagConstraints c=new GridBagConstraints();
  lblImage=new JLabel();
  setLayout(new GridBagLayout());
  lblImage.setText("");
  c.gridx=0;
  c.gridy=0;
  c.fill=java.awt.GridBagConstraints.BOTH;
  c.weightx=1.0;
  c.weighty=1.0;
  add(lblImage,c);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: ChoiceDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupButtons(){
  butOK.addActionListener(this);
  butCancel.addActionListener(this);
  GridBagLayout gridbag=new GridBagLayout();
  GridBagConstraints c=new GridBagConstraints();
  panButtons.setLayout(gridbag);
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(10,5,5,5);
  c.weightx=1.0;
  c.weighty=1.0;
  c.fill=GridBagConstraints.VERTICAL;
  c.ipadx=20;
  c.ipady=5;
  c.gridwidth=1;
  gridbag.setConstraints(butOK,c);
  panButtons.add(butOK);
  c.gridwidth=GridBagConstraints.REMAINDER;
  gridbag.setConstraints(butCancel,c);
  panButtons.add(butCancel);
}
 

Project Name: rmoffice Package: net.sf.rmoffice.ui.panels

Source Code: ModifySkillDialog.java (Click to view .java file)

Method Code:
vote
like

/** 
 */
private void initComponents(ISkill skill,SkillType rankType){
  setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  c.gridx=0;
  c.gridy=0;
  c.fill=GridBagConstraints.BOTH;
  c.insets=new Insets(2,3,2,3);
  add(new JLabel(RESOURCE.getString("message.skills.modifyname") + ":"),c);
  c.gridx++;
  tfName=new JTextField(skill.getName());
  add(tfName,c);
  c.gridy++;
  c.gridx=0;
  add(new JLabel(RESOURCE.getString("message.skills.skilltype") + ":"),c);
  c.gridx++;
  SkillType[] choices=new SkillType[SkillType.values().length];
  choices[0]=null;
  choices[1]=SkillType.DEFAULT;
  choices[2]=SkillType.EVERYMAN;
  choices[3]=SkillType.OCCUPATIONAL;
  choices[4]=SkillType.RESTRICTED;
  DefaultComboBoxModel model=new DefaultComboBoxModel(choices);
  cbSkillType=new JComboBox(model);
  cbSkillType.setEditable(false);
  cbSkillType.setRenderer(new ComboboxSkillTypeRenderer());
  if (rankType != null) {
    model.setSelectedItem(rankType);
  }
  add(cbSkillType,c);
}
 

Project Name: rmoffice Package: net.sf.rmoffice.ui.panels

Source Code: LevelUpStatusBar.java (Click to view .java file)

Method Code:
vote
like

/** 
 */
public LevelUpStatusBar(){
  super(new GridBagLayout());
  setBackground(new Color(137,187,247));
  setVisible(false);
  setBorder(new JideTitledBorder(new PartialEtchedBorder(PartialEtchedBorder.LOWERED,PartialSide.NORTH),RESOURCE.getString("ui.levelup.title")));
  GridBagConstraints c=new GridBagConstraints();
  c.anchor=GridBagConstraints.CENTER;
  c.insets=new Insets(4,10,4,10);
  c.gridx=0;
  c.gridy=0;
  c.weightx=0.5;
  lbl1=new JLabel("");
  add(lbl1,c);
  lblSpellRanks=new JLabel("");
  lblSpellRanks.setFont(lblSpellRanks.getFont().deriveFont(Font.BOLD));
  if (RMPreferences.getInstance().getSpelllistDPIncrease() > 0) {
    c.gridy++;
    add(lblSpellRanks,c);
  }
  c.gridy=0;
  c.gridheight=2;
  c.gridx++;
  lbl2=new JLabel("");
  add(lbl2,c);
}
 

Project Name: rmoffice Package: net.sf.rmoffice.ui.panels

Source Code: MagicalItemPanel.java (Click to view .java file)

Method Code:
vote
like

private void createButtonsFeatures(GridBagConstraints gc){
  gc.gridwidth=1;
  gc.gridy++;
  JButton btNewSkill=new JButton(RESOURCE.getString("ui.items.newFeature"),UIConstants.ICON_NEWLINE);
  btNewSkill.addActionListener(this);
  btNewSkill.setActionCommand(CMD_NEW_FEAT);
  Bindings.bind(btNewSkill,"enabled",enabledHolderItemSelected);
  add(btNewSkill,gc);
  gc.gridx=4;
  JButton btDelSkill=new JButton(RESOURCE.getString("ui.items.delFeature"),UIConstants.ICON_DELETE);
  btDelSkill.addActionListener(this);
  btDelSkill.setActionCommand(CMD_DEL_FEAT);
  Bindings.bind(btDelSkill,"enabled",enabledHolderItemSelected);
  add(btDelSkill,gc);
}
 

Project Name: rmoffice Package: net.sf.rmoffice.ui.panels

Source Code: CoinsPanel.java (Click to view .java file)

Method Code:
vote
like

private void create(JPanel panel,String labelResKey,String prop,GridBagConstraints col1,GridBagConstraints col2){
  col1.gridy++;
  panel.add(new JLabel(RESOURCE.getString(labelResKey)),col1);
  JTextField tf=new JTextField(10);
  Bindings.bind(tf,adapter.getValueModel(prop));
  col2.gridy++;
  panel.add(tf,col2);
}
 

Project Name: vfsjfilechooser Package: net.sf.vfsjfilechooser.accessories.bookmarks

Source Code: BookmarksEditorPanel.java (Click to view .java file)

Method Code:
vote
like

private void makeGridPanel(Component[] components){
  final Insets insets=new Insets(5,5,5,5);
  final GridBagConstraints gbc=new GridBagConstraints();
  gbc.weightx=1.0;
  gbc.weighty=1.0;
  gbc.insets=insets;
  gbc.ipadx=0;
  gbc.ipady=0;
  gbc.anchor=GridBagConstraints.EAST;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  int i=0;
  int j=0;
  for (  Component component : components) {
    gbc.gridx=i;
    gbc.gridy=j;
    gbc.gridwidth=1;
    gbc.gridheight=1;
    centerPanel.add(component,gbc);
    i++;
    if ((i % 2) == 0) {
      j++;
      i=0;
    }
  }
}
 

Project Name: vfsjfilechooser Package: net.sf.vfsjfilechooser.accessories.connection

Source Code: ConnectionDialog.java (Click to view .java file)

Method Code:
vote
like

private void makeGridPanel(Component[] components){
  final Insets insets=new Insets(5,5,5,5);
  final GridBagConstraints gbc=new GridBagConstraints();
  gbc.weightx=1.0;
  gbc.weighty=1.0;
  gbc.insets=insets;
  gbc.ipadx=0;
  gbc.ipady=0;
  gbc.anchor=GridBagConstraints.EAST;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  int i=0;
  int j=0;
  for (  Component component : components) {
    gbc.gridx=i;
    gbc.gridy=j;
    gbc.gridwidth=1;
    gbc.gridheight=1;
    centerPanel.add(component,gbc);
    i++;
    if ((i % 2) == 0) {
      j++;
      i=0;
    }
  }
}
 

Project Name: weka Package: weka.gui.experiment

Source Code: RunPanel.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates the run panel with no initial experiment.
 */
public RunPanel(){
  m_StartBut.addActionListener(this);
  m_StopBut.addActionListener(this);
  m_StartBut.setEnabled(false);
  m_StopBut.setEnabled(false);
  m_StartBut.setMnemonic('S');
  m_StopBut.setMnemonic('t');
  m_Log.statusMessage(NOT_RUNNING);
  JPanel controls=new JPanel();
  GridBagLayout gb=new GridBagLayout();
  GridBagConstraints constraints=new GridBagConstraints();
  controls.setBorder(BorderFactory.createEmptyBorder(10,5,10,5));
  controls.setLayout(gb);
  constraints.gridx=0;
  constraints.gridy=0;
  constraints.weightx=5;
  constraints.fill=GridBagConstraints.HORIZONTAL;
  constraints.gridwidth=1;
  constraints.gridheight=1;
  constraints.insets=new Insets(0,2,0,2);
  controls.add(m_StartBut,constraints);
  constraints.gridx=1;
  constraints.gridy=0;
  constraints.weightx=5;
  constraints.gridwidth=1;
  constraints.gridheight=1;
  controls.add(m_StopBut,constraints);
  setLayout(new BorderLayout());
  add(controls,BorderLayout.NORTH);
  add(m_Log,BorderLayout.CENTER);
}
 

Project Name: weka Package: weka.gui.experiment

Source Code: GeneratorPropertyIteratorPanel.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates the property iterator panel initially disabled.
 */
public GeneratorPropertyIteratorPanel(){
  String[] options={"Disabled","Enabled"};
  ComboBoxModel cbm=new DefaultComboBoxModel(options);
  m_StatusBox.setModel(cbm);
  m_StatusBox.setSelectedIndex(0);
  m_StatusBox.addActionListener(this);
  m_StatusBox.setEnabled(false);
  m_ConfigureBut.setEnabled(false);
  m_ConfigureBut.addActionListener(this);
  JPanel buttons=new JPanel();
  GridBagLayout gb=new GridBagLayout();
  GridBagConstraints constraints=new GridBagConstraints();
  buttons.setBorder(BorderFactory.createEmptyBorder(10,5,10,5));
  buttons.setLayout(gb);
  constraints.gridx=0;
  constraints.gridy=0;
  constraints.weightx=5;
  constraints.fill=GridBagConstraints.HORIZONTAL;
  constraints.gridwidth=1;
  constraints.gridheight=1;
  constraints.insets=new Insets(0,2,0,2);
  buttons.add(m_StatusBox,constraints);
  constraints.gridx=1;
  constraints.gridy=0;
  constraints.weightx=5;
  constraints.gridwidth=1;
  constraints.gridheight=1;
  buttons.add(m_ConfigureBut,constraints);
  buttons.setMaximumSize(new Dimension(buttons.getMaximumSize().width,buttons.getMinimumSize().height));
  setBorder(BorderFactory.createTitledBorder("Generator properties"));
  setLayout(new BorderLayout());
  add(buttons,BorderLayout.NORTH);
  m_ArrayEditor.setBorder(BorderFactory.createEtchedBorder());
  m_ArrayEditor.addPropertyChangeListener(new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent e){
      System.err.println("Updating experiment property iterator array");
      m_Exp.setPropertyArray(m_ArrayEditor.getValue());
    }
  }
);
  add(m_ArrayEditor,BorderLayout.CENTER);
}
 

Project Name: weka Package: weka.gui.experiment

Source Code: HostListPanel.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Create the host list panel initially disabled.
 */
public HostListPanel(){
  m_List=new JList();
  m_List.setModel(new DefaultListModel());
  m_DeleteBut.setEnabled(false);
  m_DeleteBut.addActionListener(this);
  m_HostField.addActionListener(this);
  setLayout(new BorderLayout());
  setBorder(BorderFactory.createTitledBorder("Hosts"));
  JPanel topLab=new JPanel();
  GridBagLayout gb=new GridBagLayout();
  GridBagConstraints constraints=new GridBagConstraints();
  topLab.setBorder(BorderFactory.createEmptyBorder(10,5,10,5));
  topLab.setLayout(gb);
  constraints.gridx=0;
  constraints.gridy=0;
  constraints.weightx=5;
  constraints.fill=GridBagConstraints.HORIZONTAL;
  constraints.gridwidth=1;
  constraints.gridheight=1;
  constraints.insets=new Insets(0,2,0,2);
  topLab.add(m_DeleteBut,constraints);
  constraints.gridx=1;
  constraints.gridy=0;
  constraints.weightx=5;
  constraints.gridwidth=1;
  constraints.gridheight=1;
  topLab.add(m_HostField,constraints);
  add(topLab,BorderLayout.NORTH);
  add(new JScrollPane(m_List),BorderLayout.CENTER);
}