Java Code Examples for java.awt.Insets

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project pos_1, under directory /src-pos/com/openbravo/pos/sales/restaurant/.

Source file: JCalendarItemRenderer.java

  19 
vote

public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (m_bDone) {
    Insets in=getInsets();
    g.drawLine(in.left,10,getWidth() - in.right,10);
  }
}
 

Example 2

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/.

Source file: TableLayout.java

  18 
vote

public void setTablePadding(int hpadding,int vpadding){
  setTablePadding(new Insets(0,0,vpadding,hpadding));
  setColumnPadding(0,new Insets(0,hpadding,vpadding,hpadding));
  setRowPadding(0,new Insets(vpadding,0,vpadding,hpadding));
  setCellPadding(0,0,new Insets(vpadding,hpadding,vpadding,hpadding));
}
 

Example 3

From project Chess_1, under directory /src/chess/gui/.

Source file: GridPanel.java

  18 
vote

/** 
 * Paint this component.
 * @param g the Graphics object to use to render this component
 */
public void paintComponent(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  super.paintComponent(g2);
  if (grid == null)   return;
  Insets insets=getInsets();
  g2.setColor(backgroundColor);
  g2.fillRect(insets.left,insets.top,numCols * (cellSize + 1) + 1,numRows * (cellSize + 1) + 1);
  drawWatermark(g2);
  drawGridlines(g2);
  drawOccupants(g2);
  drawCurrentLocation(g2);
}
 

Example 4

From project Clotho-Core, under directory /ClothoApps/PluginManager/src/org/clothocore/tool/pluginmanager/gui/.

Source file: ChoosePreferredViewers.java

  18 
vote

@Override protected void paintComponent(Graphics g){
  super.paintComponent(g);
  if (!loadingDone && faderTimer == null) {
    return;
  }
  Insets insets=getInsets();
  int x=insets.left;
  int y=insets.top;
  int width=getWidth() - insets.left - insets.right;
  int height=getHeight() - insets.top - insets.bottom;
  Graphics2D g2=(Graphics2D)g;
  g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  Composite oldComposite=g2.getComposite();
  if (damaged) {
    drawableAvatars=sortAvatarsByDepth(x,y,width,height);
    damaged=false;
  }
  drawAvatars(g2,drawableAvatars);
  if (drawableAvatars.length > 0) {
    drawAvatarName(g2);
  }
  g2.setComposite(oldComposite);
}
 

Example 5

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/swing/.

Source file: RootPanel.java

  18 
vote

public Rectangle getScreenExtents(){
  Rectangle extents;
  if (enclosingScrollPane != null) {
    Rectangle bnds=enclosingScrollPane.getViewportBorderBounds();
    extents=new Rectangle(0,0,bnds.width,bnds.height);
  }
 else {
    extents=new Rectangle(getWidth(),getHeight());
    Insets insets=getInsets();
    extents.width-=insets.left + insets.right;
    extents.height-=insets.top + insets.bottom;
  }
  return extents;
}
 

Example 6

From project formic, under directory /src/java/net/java/swingfx/waitwithstyle/.

Source file: SingleComponentInfiniteProgress.java

  18 
vote

private void makeSnapshot() throws AWTException {
  final Rectangle bounds=getBounds();
  final Point upperLeft=new Point(bounds.x,bounds.y);
  SwingUtilities.convertPointToScreen(upperLeft,this);
  final Rectangle screenRect=new Rectangle(upperLeft.x,upperLeft.y,bounds.width,bounds.height);
  Insets insets=getInsets();
  screenRect.x+=insets.left;
  screenRect.y+=insets.top;
  screenRect.width-=insets.left + insets.right;
  screenRect.height-=insets.top + insets.bottom;
  imageBuf=new Robot().createScreenCapture(screenRect);
}
 

Example 7

From project JoshEdit, under directory /org/lateralgm/joshedit/.

Source file: Caret.java

  18 
vote

/** 
 * Repaint the caret. 
 */
protected final synchronized void repaint(){
  if (painter != null) {
    FontMetrics fm=painter.getFontMetrics(painter.getFont());
    Insets i=painter.getInsets();
    int gw=fm.getMaxAdvance(), gh=fm.getHeight();
    if (joshText.sel.type == ST.RECT)     painter.repaint(i.left + col * gw,i.top + row * gh,gw + 1,gh);
 else     painter.repaint(i.left + joshText.line_wid_at(row,col),i.top + row * gh,insert ? gw + 1 : 2,gh);
  }
}
 

Example 8

From project LateralGM, under directory /org/lateralgm/jedit/.

Source file: JEditTextArea.java

  18 
vote

public Dimension preferredLayoutSize(Container parent){
  Dimension dim=new Dimension();
  Insets insets=getInsets();
  dim.width=insets.left + insets.right;
  dim.height=insets.top + insets.bottom;
  Dimension centerPref=center.getPreferredSize();
  dim.width+=centerPref.width;
  dim.height+=centerPref.height;
  Dimension rightPref=right.getPreferredSize();
  dim.width+=rightPref.width;
  Dimension bottomPref=bottom.getPreferredSize();
  dim.height+=bottomPref.height;
  return dim;
}
 

Example 9

From project Openbravo-POS-iPhone-App, under directory /UnicentaPOS/src-pos/com/openbravo/pos/sales/restaurant/.

Source file: JCalendarItemRenderer.java

  18 
vote

public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (m_bDone) {
    Insets in=getInsets();
    g.drawLine(in.left,10,getWidth() - in.right,10);
  }
}
 

Example 10

From project OpenEMRConnect, under directory /reception/src/ke/go/moh/oec/reception/gui/custom/.

Source file: ImagePanel.java

  18 
vote

@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (image != null) {
    Insets insets=getInsets();
    int transX=insets.left;
    int transY=insets.top;
    int width=getWidth() - getInsets().right - getInsets().left;
    int height=getHeight() - getInsets().bottom - getInsets().top;
    g.drawImage(image,transX,transY,width,height,null);
  }
}
 

Example 11

From project pgslookandfeel, under directory /src/main/java/com/pagosoft/plaf/.

Source file: PgsLookAndFeel.java

  18 
vote

protected void initComponentDefaults(UIDefaults table){
  super.initComponentDefaults(table);
  MetalTheme theme=getCurrentTheme();
  Insets menuInsets=new InsetsUIResource(0,2,0,3);
  Insets buttonMargin=PlafOptions.useExtraMargin() ? new InsetsUIResource(1,14,1,14) : new InsetsUIResource(1,4,1,4);
  Color gradientStart=ColorUtils.getSimiliarColor(theme.getControl(),1.4f);
  Color gradientEnd=ColorUtils.getSimiliarColor(theme.getControl(),0.9f);
  Color specialGradientStart=ColorUtils.getSimiliarColor(theme.getPrimaryControlShadow(),1.4f);
  Color specialGradientEnd=ColorUtils.getSimiliarColor(theme.getPrimaryControlShadow(),0.9f);
  Object[] uiDefaults={"glow",ColorUtils.getTranslucentColor(theme.getPrimaryControl(),175),"Button.border",PgsBorders.getButtonBorder(),"Button.margin",buttonMargin,"Button.rolloverBackground",theme.getControlShadow(),"Button.isFlat",PlafOptions.isFlat("Button"),"Button.gradientStart",gradientStart,"Button.gradientEnd",gradientEnd,"Button.rolloverGradientStart",gradientStart,"Button.rolloverGradientEnd",gradientEnd,"Button.selectedGradientStart",gradientEnd,"Button.selectedGradientEnd",gradientStart,"Button.rolloverVistaStyle",Boolean.FALSE,"ToggleButton.border",PgsBorders.getButtonBorder(),"ToggleButton.margin",buttonMargin,"ToggleButton.rolloverBackground",theme.getControlShadow(),"ToggleButton.isFlat",PlafOptions.isFlat("Button"),"ToggleButton.gradientStart",gradientStart,"ToggleButton.gradientEnd",gradientEnd,"ToggleButton.rolloverGradientStart",gradientStart,"ToggleButton.rolloverGradientEnd",gradientEnd,"ToggleButton.selectedGradientStart",ColorUtils.getSimiliarColor(theme.getControl(),0.5f),"ToggleButton.selectedGradientEnd",ColorUtils.getSimiliarColor(theme.getControl(),0.9f),"RadioButton.border",PgsBorders.getButtonBorder(),"RadioButton.icon",PgsIconFactory.getRadioButtonIcon(),"CheckBox.border",PgsBorders.getButtonBorder(),"CheckBox.icon",PgsIconFactory.getCheckBoxIcon(),"TabbedPane.tabGradientStart",gradientStart,"TabbedPane.tabGradientEnd",gradientEnd,"TabbedPane.focusPainted",Boolean.FALSE,"TabbedPane.buttonStyle.background",theme.getControl(),"TabbedPane.buttonStyle.selectedBackground",new ColorUIResource(ColorUtils.getTranslucentColor(theme.getPrimaryControlDarkShadow(),100)),"TabbedPane.buttonStyle.rolloverBackground",new ColorUIResource(ColorUtils.getTranslucentColor(theme.getPrimaryControlShadow(),100)),"TabbedPane.buttonStyle.selectedBorder",theme.getPrimaryControlDarkShadow(),"TabbedPane.buttonStyle.rolloverBorder",theme.getPrimaryControlDarkShadow(),"ToolBar.gradientStart",gradientStart,"ToolBar.gradientEnd",gradientEnd,"ToolBar.border",PgsBorders.getToolBarBorder(),"ToolBar.borderColor",theme.getControlShadow(),"ToolBarButton.margin",new InsetsUIResource(3,3,3,3),"ToolBarButton.rolloverBackground",theme.getPrimaryControl(),"ToolBarButton.rolloverBorderColor",theme.getPrimaryControlDarkShadow(),"ToolBarButton.isFlat",PlafOptions.isFlat("ToolBarButton"),"ToolBarButton.gradientStart",gradientStart,"ToolBarButton.gradientEnd",gradientEnd,"ToolBarButton.rolloverGradientStart",specialGradientStart,"ToolBarButton.rolloverGradientEnd",specialGradientEnd,"ToolBarButton.selectedGradientStart",specialGradientEnd,"ToolBarButton.selectedGradientEnd",specialGradientStart,"ComboBox.border",PgsBorders.getTextFieldBorder(),"ComboBox.editorBorder",null,"ComboBox.selectionBackground",theme.getPrimaryControl(),"ComboBox.popup.border",BorderFactory.createLineBorder(theme.getControlDarkShadow()),"Menu.submenuPopupOffsetX",new Integer(0),"Menu.selectionBackground",theme.getPrimaryControl(),"Menu.selectedBorderMargin",menuInsets,"Menu.selectedBorderColor",theme.getPrimaryControlDarkShadow(),"Menu.gradientStart",specialGradientStart,"Menu.gradientEnd",specialGradientEnd,"Menu.borderPainted",Boolean.FALSE,"MenuItem.selectionBackground",theme.getPrimaryControl(),"MenuItem.selectedBorderMargin",menuInsets,"MenuItem.selectedBorderColor",theme.getPrimaryControlDarkShadow(),"MenuItem.gradientStart",specialGradientStart,"MenuItem.gradientEnd",specialGradientEnd,"MenuItem.isFlat",PlafOptions.isFlat("MenuItem"),"MenuItem.borderPainted",Boolean.FALSE,"CheckBoxMenuItem.selectionBackground",theme.getPrimaryControl(),"CheckBoxMenuItem.selectedBorderMargin",menuInsets,"CheckBoxMenuItem.selectedBorderColor",theme.getPrimaryControlDarkShadow(),"CheckBoxMenuItem.gradientStart",specialGradientStart,"CheckBoxMenuItem.gradientEnd",specialGradientEnd,"CheckBoxMenuItem.isFlat",PlafOptions.isFlat("MenuItem"),"CheckBoxMenuItem.borderPainted",Boolean.FALSE,"CheckBoxMenuItem.checkIcon",PgsIconFactory.getCheckBoxMenuItemIcon(),"RadioButtonMenuItem.selectionBackground",theme.getPrimaryControl(),"RadioButtonMenuItem.selectedBorderMargin",menuInsets,"RadioButtonMenuItem.selectedBorderColor",theme.getPrimaryControlDarkShadow(),"RadioButtonMenuItem.gradientStart",specialGradientStart,"RadioButtonMenuItem.gradientEnd",specialGradientEnd,"RadioButtonMenuItem.isFlat",PlafOptions.isFlat("MenuItem"),"RadioButtonMenuItem.borderPainted",Boolean.FALSE,"RadioButtonMenuItem.checkIcon",PgsIconFactory.getRadioButtonMenuItemIcon(),"MenuBar.isFlat",PlafOptions.isFlat("MenuBar"),"MenuBar.gradientStart",gradientStart,"MenuBar.gradientEnd",gradientEnd,"MenuBarMenu.isFlat",PlafOptions.isFlat("MenuBarMenu"),"MenuBarMenu.foreground",theme.getMenuForeground(),"MenuBarMenu.rolloverBorderColor",theme.getControlTextColor(),"MenuBarMenu.selectedBorderColor",theme.getPrimaryControlDarkShadow(),"MenuBarMenu.rolloverBackground",theme.getControlShadow(),"MenuBarMenu.selectedBackground",theme.getPrimaryControl(),"MenuBarMenu.rolloverBackgroundGradientStart",specialGradientStart,"MenuBarMenu.rolloverBackground.gradientStart",specialGradientStart,"MenuBarMenu.rolloverBackgroundGradientEnd",specialGradientEnd,"MenuBarMenu.rolloverBackground.gradientEnd",specialGradientEnd,"MenuBarMenu.selectedBackgroundGradientStart",specialGradientEnd,"MenuBarMenu.selectedBackgroundGradientEnd",specialGradientStart,"MenuBarMenu.selectedBackground.gradientStart",specialGradientEnd,"MenuBarMenu.selectedBackground.gradientEnd",specialGradientStart,"ProgressBar.border",PgsBorders.getComponentBorder(),"ProgressBar.gradientStart",gradientStart,"ProgressBar.gradientEnd",gradientEnd,"ProgressBar.innerGradientStart",specialGradientStart,"ProgressBar.innerGradientEnd",specialGradientEnd,"ProgressBar.innerDisabledGradientStart",gradientStart,"ProgressBar.innerDisabledGradientEnd",gradientEnd,"ProgressBar.innerBorderColor",theme.getPrimaryControlDarkShadow(),"ProgressBar.innerDisabledBorderColor",theme.getControlDarkShadow(),"ScrollBar.track",theme.getControlShadow(),"ScrollBar.trackHighlight",theme.getControl(),"ScrollPane.border",BorderFactory.createLineBorder(PgsLookAndFeel.getControlDarkShadow(),1),"TextField.border",PgsBorders.getTextFieldBorder(),"TextField.margin",new InsetsUIResource(2,2,2,2),"FormattedTextField.border",PgsBorders.getTextFieldBorder(),"FormattedTextField.margin",new InsetsUIResource(2,2,2,2),"PasswordField.border",PgsBorders.getTextFieldBorder(),"PasswordField.margin",new InsetsUIResource(2,2,2,2),"TextArea.margin",new InsetsUIResource(2,2,2,2),"EditorPane.border",PgsBorders.getTextFieldBorder(),"EditorPane.margin",new InsetsUIResource(2,2,2,2),"TextPane.border",PgsBorders.getTextFieldBorder(),"TextPane.margin",new InsetsUIResource(2,2,2,2),"Tooltip.gradientStart",gradientStart,"Tooltip.gradientEnd",gradientEnd,"ToolTip.border",BorderFactory.createLineBorder(theme.getControlDarkShadow(),1),"Table.scrollPaneBorder",PgsBorders.getComponentBorder(),"TabbedPane.background",PgsLookAndFeel.getControlShadow(),"SplitPane.border",null,"SplitPaneDivider.border",null,"OptionPane.errorIcon",makeIcon(getClass(),"icons/Error.png"),"OptionPane.informationIcon",makeIcon(getClass(),"icons/Inform.png"),"OptionPane.warningIcon",makeIcon(getClass(),"icons/Warn.png"),"OptionPane.questionIcon",makeIcon(getClass(),"icons/Question.png"),"FileView.computerIcon",makeIcon(getClass(),"icons/Computer.png"),"FileView.directoryIcon",makeIcon(getClass(),"icons/TreeClosed.png"),"FileView.fileIcon",makeIcon(getClass(),"icons/File.png"),"FileView.floppyDriveIcon",makeIcon(getClass(),"icons/FloppyDrive.png"),"FileView.hardDriveIcon",makeIcon(getClass(),"icons/HardDrive.png"),"FileChooser.homeFolderIcon",makeIcon(getClass(),"icons/HomeFolder.png"),"FileChooser.newFolderIcon",makeIcon(getClass(),"icons/NewFolder.png"),"FileChooser.upFolderIcon",makeIcon(getClass(),"icons/UpFolder.png"),"Tree.closedIcon",makeIcon(getClass(),"icons/TreeClosed.png"),"Tree.openIcon",makeIcon(getClass(),"icons/TreeOpen.png"),"Tree.leafIcon",makeIcon(getClass(),"icons/TreeLeaf.png")};
  table.putDefaults(uiDefaults);
}
 

Example 12

From project QView, under directory /QView-suite/MQProject/src/org/qview/gui/hypertree/.

Source file: HTDraw.java

  18 
vote

/** 
 * Refresh the screen coordinates of the drawing tree.
 */
void refreshScreenCoordinates(){
  Insets insets=fView.getInsets();
  fsMax.fx=(fView.getWidth() - insets.left - insets.right) / 2 - fBorder;
  fsMax.fy=(fView.getHeight() - insets.top - insets.bottom) / 2 - fBorder;
  fsOrigin.fx=fsMax.fx + insets.left + fBorder;
  fsOrigin.fy=fsMax.fy + insets.top + fBorder;
  fDrawRoot.refreshScreenCoordinates(fsOrigin,fsMax);
}
 

Example 13

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/corecomponents/.

Source file: Installer.java

  17 
vote

@Override public void restored(){
  WindowManager.getDefault().invokeWhenUIReady(new Runnable(){
    @Override public void run(){
      Case.invokeStartupDialog();
    }
  }
);
  Logger logger=Logger.getLogger(Installer.class.getName());
  UIManager.put("ViewTabDisplayerUI","org.sleuthkit.autopsy.corecomponents.NoTabsTabDisplayerUI");
  UIManager.put(DefaultTabbedContainerUI.KEY_VIEW_CONTENT_BORDER,BorderFactory.createEmptyBorder());
  UIManager.put("TabbedPane.contentBorderInsets",new Insets(0,0,0,0));
}
 

Example 14

From project BMach, under directory /src/bmach/ui/gui/components/.

Source file: JIconTextField.java

  17 
vote

@Override protected void paintComponent(Graphics g){
  super.paintComponent(g);
  int textX=2;
  if (this.icon != null) {
    int iconWidth=icon.getIconWidth();
    int iconHeight=icon.getIconHeight();
    int x=dummyInsets.left + 5;
    textX=x + iconWidth + 2;
    int y=(this.getHeight() - iconHeight) / 2;
    icon.paintIcon(this,g,x,y);
  }
  setMargin(new Insets(2,textX,2,2));
}
 

Example 15

From project Cinch, under directory /example/com/palantir/ptoss/cinch/example/simple/.

Source file: OnChangeExample.java

  17 
vote

GridBagConstraints getDefaultGBC(){
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridheight=1;
  gbc.gridwidth=1;
  gbc.gridy=0;
  gbc.gridx=0;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  gbc.weightx=1;
  gbc.weighty=1;
  gbc.ipadx=5;
  gbc.ipady=5;
  gbc.insets=new Insets(10,0,10,0);
  return gbc;
}
 

Example 16

From project codjo-imports, under directory /codjo-imports-gui/src/main/java/net/codjo/imports/gui/wizard/.

Source file: ImportSelectionStep.java

  17 
vote

@Override public void buildLayout(){
  importTypeCombo=new RequestComboBox();
  importTypeCombo.setName("importTypeComboBox");
  importTypeCombo.setModelFieldName("fileType");
  importTypeCombo.setRendererFieldName("fileType");
  importFilePath=new FilePathField();
  importFilePath.setName("importFilePath");
  errorLabel=new JLabel();
  errorLabel.setName("errorLabel");
  setLayout(new GridBagLayout());
  Insets insets=new Insets(4,4,4,4);
  importTypeComboLabel=new JLabel();
  add(importTypeComboLabel,new GridBagConstraints(0,0,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,insets,0,0));
  add(importTypeCombo,new GridBagConstraints(1,0,1,1,1.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,new Insets(4,4,4,4),0,0));
  importFilePathLabel=new JLabel();
  add(importFilePathLabel,new GridBagConstraints(0,1,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,4,4,4),0,0));
  add(importFilePath,new GridBagConstraints(1,1,1,1,1.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,new Insets(4,4,4,4),0,0));
  add(errorLabel,new GridBagConstraints(0,2,2,1,1.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,new Insets(4,4,4,4),0,0));
}
 

Example 17

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/settings/.

Source file: AxisTreeToolBar.java

  17 
vote

public static void doEffect(JToolBar tb){
  Component[] components=tb.getComponents();
  for (  Component component : components) {
    if (component instanceof JButton) {
      ((JButton)component).setMargin(new Insets(1,3,1,3));
    }
  }
}
 

Example 18

From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogFactor5Dialog.java

  17 
vote

protected GridBagConstraints getDefaultConstraints(){
  GridBagConstraints constraints=new GridBagConstraints();
  constraints.weightx=1.0;
  constraints.weighty=1.0;
  constraints.gridheight=1;
  constraints.insets=new Insets(4,4,4,4);
  constraints.fill=GridBagConstraints.NONE;
  constraints.anchor=GridBagConstraints.WEST;
  return constraints;
}
 

Example 19

From project engine, under directory /main/com/midtro/platform/.

Source file: FrameLauncher.java

  17 
vote

/** 
 * Sets up and shows the frame.
 */
private void initializeFrame(){
  super.setFocusable(true);
  super.enableEvents(AWTEvent.WINDOW_EVENT_MASK);
  super.setSize(app.getSettings().getWidth(),app.getSettings().getHeight());
  super.setBackground(app.getSettings().getBackgroundColor());
  super.setTitle(app.getSettings().getTitle());
  super.setResizable(false);
  super.setLayout(new BorderLayout());
  super.add(engine,BorderLayout.CENTER);
  super.validate();
  super.pack();
  super.setVisible(true);
  super.toFront();
  final Insets insets=getInsets();
  super.setSize(app.getSettings().getWidth() + insets.left + insets.right,app.getSettings().getHeight() + insets.top + insets.bottom);
  engine.start();
}
 

Example 20

From project FBReaderJ, under directory /obsolete/swing/src/org/geometerplus/zlibrary/ui/swing/dialogs/.

Source file: ZLSwingDialogContent.java

  17 
vote

protected ZLSwingDialogContent(ZLResource resource){
  super(resource);
  myContentPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  myContentPanel.setLayout(myLayout);
  myConstraints.fill=GridBagConstraints.HORIZONTAL;
  myConstraints.anchor=GridBagConstraints.WEST;
  myConstraints.gridx=0;
  myConstraints.gridy=0;
  myConstraints.insets=new Insets(5,5,0,5);
  myConstraints.weightx=1;
  myConstraints.ipady=0;
}
 

Example 21

From project freemind, under directory /freemind/accessories/plugins/util/xslt/.

Source file: ExportDialog.java

  17 
vote

private GridBagConstraints makegbc(int x,int y,int width,int height){
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=x;
  gbc.gridy=y;
  gbc.gridwidth=width;
  gbc.gridheight=height;
  gbc.insets=new Insets(1,1,1,1);
  gbc.anchor=gbc.WEST;
  return gbc;
}
 

Example 22

From project gitblit, under directory /src/com/gitblit/client/.

Source file: EditRepositoryDialog.java

  17 
vote

public void setCustomFields(RepositoryModel repository,Map<String,String> customFields){
  customFieldsPanel.removeAll();
  customTextfields=new ArrayList<JTextField>();
  final Insets insets=new Insets(5,5,5,5);
  JPanel fields=new JPanel(new GridLayout(0,1,0,5)){
    private static final long serialVersionUID=1L;
    @Override public Insets getInsets(){
      return insets;
    }
  }
;
  for (  Map.Entry<String,String> entry : customFields.entrySet()) {
    String field=entry.getKey();
    String value="";
    if (repository.customFields != null && repository.customFields.containsKey(field)) {
      value=repository.customFields.get(field);
    }
    JTextField textField=new JTextField(value);
    textField.setName(field);
    textField.setPreferredSize(new Dimension(450,26));
    fields.add(newFieldPanel(entry.getValue(),250,textField));
    customTextfields.add(textField);
  }
  JScrollPane jsp=new JScrollPane(fields);
  jsp.getVerticalScrollBar().setBlockIncrement(100);
  jsp.getVerticalScrollBar().setUnitIncrement(100);
  jsp.setViewportBorder(null);
  customFieldsPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
  customFieldsPanel.add(jsp);
}
 

Example 23

From project grid-goggles, under directory /Dependent Libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  17 
vote

private void launch(){
  GraphicsDevice displayDevice=null;
  if (displayDevice == null) {
    GraphicsEnvironment environment=GraphicsEnvironment.getLocalGraphicsEnvironment();
    displayDevice=environment.getDefaultScreenDevice();
  }
  frame=new Frame(displayDevice.getDefaultConfiguration());
  frame.setResizable(false);
  init();
  frame.pack();
  frame.setLocation(x,y);
  Insets insets=frame.getInsets();
  int windowW=Math.max(width,MIN_WINDOW_WIDTH) + insets.left + insets.right;
  int windowH=Math.max(height,MIN_WINDOW_HEIGHT) + insets.top + insets.bottom;
  frame.setSize(windowW,windowH);
  frame.setLayout(null);
  frame.add(this);
  frame.setBackground(Color.black);
  int usableWindowH=windowH - insets.top - insets.bottom;
  setBounds((windowW - width) / 2,insets.top + (usableWindowH - height) / 2,width,height);
  frame.addWindowListener(this);
  frame.addComponentListener(this);
  frame.setName(_myName);
  frame.setTitle(_myName + " x:" + x+ " y:"+ y+ "   w:"+ width+ " h:"+ height);
  frame.setVisible(true);
  requestFocus();
}
 

Example 24

From project gridland, under directory /src/org/grid/server/.

Source file: StackLayout.java

  17 
vote

/** 
 * Places the components.
 * @see LayoutManager#layoutContainer(Container)
 */
public void layoutContainer(Container arg0){
  Dimension base=arg0.getSize();
  Insets insets=arg0.getInsets();
  base.width-=insets.left + insets.right;
  base.height-=insets.top + insets.bottom;
switch (orientation) {
case HORIZONTAL:
{
      int offset=hPadding + insets.left;
      base.height-=2 * vPadding;
      for (int i=0; i < arg0.getComponentCount(); i++) {
        Component c=arg0.getComponent(i);
        if (!c.isVisible())         continue;
        Dimension d=c.getPreferredSize();
        c.setBounds(offset,vPadding + insets.top,d.width,align ? base.height : Math.min(d.height,base.height));
        offset+=d.width + hPadding;
      }
      break;
    }
case VERTICAL:
{
    int offset=vPadding + insets.top;
    base.width-=2 * hPadding;
    for (int i=0; i < arg0.getComponentCount(); i++) {
      Component c=arg0.getComponent(i);
      if (!c.isVisible())       continue;
      Dimension d=c.getPreferredSize();
      c.setBounds(hPadding + insets.left,offset,align ? base.width : Math.min(d.width,base.width),d.height);
      offset+=d.height + vPadding;
    }
    break;
  }
}
}
 

Example 25

From project gs-tool, under directory /src/org/graphstream/tool/gui/.

Source file: TitleLabel.java

  17 
vote

public TitleLabel(String label){
  GridBagConstraints c=new GridBagConstraints();
  JLabel l=new JLabel(label,JLabel.LEFT);
  setLayout(new GridBagLayout());
  l.setFont(Resources.getBoldFont(25.0f));
  l.setOpaque(false);
  c.insets=new Insets(5,10,5,10);
  c.weightx=1.0;
  c.fill=GridBagConstraints.HORIZONTAL;
  add(l,c);
  background=Resources.getImage(Resources.LINES,0,0,true);
}
 

Example 26

From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/haven/.

Source file: MainFrame.java

  17 
vote

public MainFrame(int w,int h){
  super("");
  setTitle(null);
  instance=this;
  innerSize=new Dimension(w,h);
  centerPoint=new Point(innerSize.width / 2,innerSize.height / 2);
  screenSZ=new Coord(Toolkit.getDefaultToolkit().getScreenSize());
  p=new HavenPanel(w,h);
  fsmode=findmode(w,h);
  add(p);
  pack();
  Insets insets=getInsets();
  insetsSize=new Dimension(insets.left + insets.right,insets.top + insets.bottom);
  setResizable(true);
  setMinimumSize(new Dimension(800 + insetsSize.width,600 + insetsSize.height));
  p.requestFocusInWindow();
  seticon();
  setVisible(true);
  p.init();
  setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
}
 

Example 27

From project Hotel-Management_MINF10-HCM, under directory /HotelManagement/src/main/java/core/formcontroller/.

Source file: MDIDesktopManager.java

  17 
vote

public void setNormalSize(){
  JScrollPane scrollPane=getScrollPane();
  int x=0;
  int y=0;
  Insets scrollInsets=getScrollPaneInsets();
  if (scrollPane != null) {
    Dimension d=scrollPane.getVisibleRect().getSize();
    if (scrollPane.getBorder() != null) {
      d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,d.getHeight() - scrollInsets.top - scrollInsets.bottom);
    }
    d.setSize(d.getWidth() - 20,d.getHeight() - 20);
    desktop.setAllSize(x,y);
    scrollPane.invalidate();
    scrollPane.validate();
  }
}
 

Example 28

From project imageflow, under directory /src/de/danielsenff/imageflow/gui/.

Source file: FormPanel.java

  17 
vote

public FormPanel(){
  setLayout(new GridBagLayout());
  addMouseListener(this);
  this.parameters=new LinkedHashMap<Parameter,ArrayList<Component>>();
  c=new GridBagConstraints();
  c.insets=new Insets(2,2,2,2);
  c.anchor=GridBagConstraints.LINE_START;
  c.ipady=0;
  c.gridwidth=1;
  c.gridheight=1;
  rows=0;
}
 

Example 29

From project isohealth, under directory /Oauth/java/jmeter/jmeter/src/main/java/org/apache/jmeter/protocol/oauth/control/gui/.

Source file: OAuthConfigGui.java

  17 
vote

/** 
 * The constraints used by GridBagLayout manager.
 */
private void createConstraints(){
  fixedConstraints=new GridBagConstraints();
  fixedConstraints.anchor=GridBagConstraints.CENTER;
  fixedConstraints.insets=new Insets(1,1,1,1);
  fixedConstraints.weightx=0.0;
  fixedConstraints.gridwidth=1;
  fixedConstraints.gridx=GridBagConstraints.RELATIVE;
  fixedConstraints.gridy=0;
  stretchyConstraints=(GridBagConstraints)fixedConstraints.clone();
  stretchyConstraints.fill=GridBagConstraints.HORIZONTAL;
  stretchyConstraints.weightx=1.0;
  stretchyConstraints.gridwidth=GridBagConstraints.RELATIVE;
}
 

Example 30

From project JaamSim, under directory /com/sandwell/JavaSimulation3D/.

Source file: GUIFrame.java

  17 
vote

public ViewButton(String iconLocation,String description,int viewCode){
  super(new ImageIcon(GUIFrame.class.getResource(iconLocation)));
  this.setToolTipText(description);
  this.setMargin(new Insets(0,0,0,0));
  this.setEnabled(false);
  this.viewCode=viewCode;
  this.addActionListener(this);
}
 

Example 31

From project jASM_16, under directory /src/main/java/de/codesourcery/jasm16/ide/ui/utils/.

Source file: UIUtils.java

  17 
vote

protected static final GridBagConstraints constraints(int x,int y,boolean remainderHoriz,boolean remainderVert,int fill){
  final GridBagConstraints cnstrs=new GridBagConstraints();
  cnstrs.anchor=GridBagConstraints.NORTHWEST;
  cnstrs.weightx=1.0d;
  cnstrs.weighty=1.0d;
  cnstrs.fill=fill;
  cnstrs.gridheight=remainderVert ? GridBagConstraints.REMAINDER : 1;
  cnstrs.gridwidth=remainderHoriz ? GridBagConstraints.REMAINDER : 1;
  cnstrs.gridx=x;
  cnstrs.gridy=y;
  cnstrs.insets=new Insets(10,2,10,2);
  return cnstrs;
}
 

Example 32

From project jftp, under directory /src/main/java/com/myjavaworld/jftp/.

Source file: StatusWindow.java

  17 
vote

public StatusWindow(){
  super();
  setMargin(new Insets(6,6,6,6));
  document=getDocument();
  this.setEditable(false);
  initStyles();
  MessageFormat format=new MessageFormat(resources.getString("text.productInfo"));
  Object[] args={JFTPConstants.PRODUCT_NAME,JFTPConstants.PRODUCT_VERSION,JFTPConstants.PRODUCT_BUILD};
  addInfo(format.format(args));
}
 

Example 33

From project jlac, under directory /src/org/sump/analyzer/devices/.

Source file: FpgaDeviceController.java

  17 
vote

private static GridBagConstraints createConstraints(int x,int y,int w,int h,double wx,double wy){
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.fill=GridBagConstraints.BOTH;
  gbc.insets=new Insets(2,2,2,2);
  gbc.gridx=x;
  gbc.gridy=y;
  gbc.gridwidth=w;
  gbc.gridheight=h;
  gbc.weightx=wx;
  gbc.weighty=wy;
  return (gbc);
}
 

Example 34

From project jMemorize, under directory /src/jmemorize/gui/swing/widgets/.

Source file: ExtentProgressBar.java

  17 
vote

protected void paintComponent(Graphics g){
  super.paintComponent(g);
  Insets insets=getInsets();
  Color oldColor=g.getColor();
  g.setColor(extentForeground);
  double value=getModel().getValue();
  double extent=getModel().getExtent();
  double maximum=getModel().getMaximum();
  double minimum=getModel().getMinimum();
  double outerRange=maximum - minimum;
  int x=getX() + insets.left;
  int y, w, h=0;
  int barHeight=getHeight() - (insets.top + insets.bottom);
  int barWidth=getWidth() - (insets.left + insets.right);
  if (getOrientation() == HORIZONTAL) {
    y=getY() + insets.top;
    x+=(int)(barWidth * (value / outerRange));
    w=(int)(barWidth * (extent / outerRange));
    h=barHeight;
  }
 else {
    y=getY() + barHeight;
    y-=(int)(barHeight * (value / outerRange));
    h=(int)(barHeight * (extent / outerRange));
    y-=h;
    w=barWidth;
  }
  g.fillRect(x,y,w,h);
  g.setColor(oldColor);
}
 

Example 35

From project leaves, under directory /libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  17 
vote

private void launch(){
  GraphicsDevice displayDevice=null;
  if (displayDevice == null) {
    GraphicsEnvironment environment=GraphicsEnvironment.getLocalGraphicsEnvironment();
    displayDevice=environment.getDefaultScreenDevice();
  }
  frame=new Frame(displayDevice.getDefaultConfiguration());
  frame.setResizable(false);
  init();
  frame.pack();
  frame.setLocation(x,y);
  Insets insets=frame.getInsets();
  int windowW=Math.max(width,MIN_WINDOW_WIDTH) + insets.left + insets.right;
  int windowH=Math.max(height,MIN_WINDOW_HEIGHT) + insets.top + insets.bottom;
  frame.setSize(windowW,windowH);
  frame.setLayout(null);
  frame.add(this);
  frame.setBackground(Color.black);
  int usableWindowH=windowH - insets.top - insets.bottom;
  setBounds((windowW - width) / 2,insets.top + (usableWindowH - height) / 2,width,height);
  frame.addWindowListener(this);
  frame.addComponentListener(this);
  frame.setName(_myName);
  frame.setTitle(_myName + " x:" + x+ " y:"+ y+ "   w:"+ width+ " h:"+ height);
  frame.setVisible(true);
  requestFocus();
}
 

Example 36

From project log4jna, under directory /thirdparty/log4j/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogFactor5Dialog.java

  17 
vote

protected GridBagConstraints getDefaultConstraints(){
  GridBagConstraints constraints=new GridBagConstraints();
  constraints.weightx=1.0;
  constraints.weighty=1.0;
  constraints.gridheight=1;
  constraints.insets=new Insets(4,4,4,4);
  constraints.fill=GridBagConstraints.NONE;
  constraints.anchor=GridBagConstraints.WEST;
  return constraints;
}
 

Example 37

From project Maimonides, under directory /src/com/codeko/apps/maimonides/.

Source file: MaimonidesInputBlocker.java

  17 
vote

private void recreateOptionPaneMessage(JOptionPane optionPane){
  Object message=optionPane.getMessage();
  if (message instanceof String) {
    Font font=optionPane.getFont();
    final JTextArea textArea=new JTextArea((String)message);
    textArea.setFont(font);
    int lh=textArea.getFontMetrics(font).getHeight();
    Insets margin=new Insets(0,0,lh,24);
    textArea.setMargin(margin);
    textArea.setEditable(false);
    textArea.setWrapStyleWord(true);
    textArea.setBackground(optionPane.getBackground());
    JPanel panel=new JPanel(new BorderLayout());
    panel.add(textArea,BorderLayout.CENTER);
    final JProgressBar progressBar=new JProgressBar();
    progressBar.setName("BlockingDialog.progressBar");
    progressBar.setIndeterminate(true);
    PropertyChangeListener taskPCL=new PropertyChangeListener(){
      public void propertyChange(      PropertyChangeEvent e){
        if ("progress".equals(e.getPropertyName())) {
          progressBar.setIndeterminate(false);
          progressBar.setValue((Integer)e.getNewValue());
          updateStatusBarString(progressBar);
        }
 else         if ("message".equals(e.getPropertyName())) {
          textArea.setText((String)e.getNewValue());
        }
      }
    }
;
    getTask().addPropertyChangeListener(taskPCL);
    panel.add(progressBar,BorderLayout.SOUTH);
    injectBlockingDialogComponents(panel);
    optionPane.setMessage(panel);
  }
}
 

Example 38

From project McZLauncher, under directory /src/ru/zetrix/gui/laf/.

Source file: MZButtonUI.java

  17 
vote

public void installUI(JComponent c){
  super.installUI(c);
  AbstractButton button=(AbstractButton)c;
  button.setOpaque(false);
  button.setFocusable(true);
  button.setMargin(new Insets(0,0,0,0));
  button.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
}
 

Example 39

From project nenya, under directory /core/src/main/java/com/threerings/media/.

Source file: ManagedJFrame.java

  17 
vote

/** 
 * We catch update requests and forward them on to the repaint infrastructure.
 */
@Override public void update(Graphics g){
  Shape clip=g.getClip();
  Rectangle dirty;
  if (clip != null) {
    dirty=clip.getBounds();
  }
 else {
    dirty=getRootPane().getBounds();
    Insets insets=getInsets();
    dirty.x+=insets.left;
    dirty.y+=insets.top;
  }
  if (_fmgr != null) {
    _fmgr.restoreFromBack(dirty);
  }
}
 

Example 40

From project niravCS2103, under directory /CS2103/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogFactor5Dialog.java

  17 
vote

protected GridBagConstraints getDefaultConstraints(){
  GridBagConstraints constraints=new GridBagConstraints();
  constraints.weightx=1.0;
  constraints.weighty=1.0;
  constraints.gridheight=1;
  constraints.insets=new Insets(4,4,4,4);
  constraints.fill=GridBagConstraints.NONE;
  constraints.anchor=GridBagConstraints.WEST;
  return constraints;
}
 

Example 41

From project OMS3, under directory /src/main/java/ngmfconsole/.

Source file: JPanelButton.java

  17 
vote

@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  Color c=g.getColor();
  g.setColor(isEnabled() ? Color.BLACK : Color.GRAY);
  Insets i=getInsets();
  int opSize=2;
  int newx=getWidth() - i.right - 2 * opSize;
  int newy=(int)(getHeight() * 0.75);
  g.translate(newx,newy);
  g.drawLine(-opSize,0,opSize,0);
  if (!isSelected()) {
    g.drawLine(0,-opSize,0,opSize);
  }
  g.translate(-newx,-newy);
  g.setColor(c);
}
 

Example 42

From project OpenSettlers, under directory /src/java/soc/client/.

Source file: ChannelFrame.java

  17 
vote

/** 
 * DOCUMENT ME!
 */
public void doLayout(){
  Insets i=getInsets();
  Dimension dim=getSize();
  dim.width-=(i.left + i.right);
  dim.height-=(i.top + i.bottom);
  int tfheight=tf.getPreferredSize().height;
  int h=dim.height - tfheight;
  int lw=lst.getSize().width;
  int cw=cnvs.getSize().width;
  int w=dim.width - lw - cw;
  tf.setSize(dim.width,tfheight);
  tf.setLocation(i.left,i.top + h);
  ta.setSize(w,h);
  ta.setLocation(i.left,i.top);
  cnvs.setSize(cw,h);
  cnvs.setLocation(i.left + w,i.top);
  lst.setSize(lw,h);
  lst.setLocation(w + cw + i.left,i.top);
  npix=ta.getPreferredSize(100,100).width;
  ncols=(int)((((float)w) * 100.0) / ((float)npix)) - 2;
}
 

Example 43

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/ui/swing/editors/.

Source file: RegexSearcher.java

  17 
vote

private void center(Rectangle r,boolean withInsets){
  Rectangle visible=comp.getVisibleRect();
  visible.x=r.x - (visible.width - r.width) / 2;
  visible.y=r.y - (visible.height - r.height) / 2;
  Rectangle bounds=comp.getBounds();
  Insets i=withInsets ? new Insets(0,0,0,0) : comp.getInsets();
  bounds.x=i.left;
  bounds.y=i.top;
  bounds.width-=i.left + i.right;
  bounds.height-=i.top + i.bottom;
  if (visible.x < bounds.x)   visible.x=bounds.x;
  if (visible.x + visible.width > bounds.x + bounds.width)   visible.x=bounds.x + bounds.width - visible.width;
  if (visible.y < bounds.y)   visible.y=bounds.y;
  if (visible.y + visible.height > bounds.y + bounds.height)   visible.y=bounds.y + bounds.height - visible.height;
  comp.scrollRectToVisible(visible);
}
 

Example 44

From project packetsamurai, under directory /src/com/l2j/packetsamurai/gui/.

Source file: ConsoleTab.java

  17 
vote

public ConsoleTab(){
  this.setLayout(_layout);
  _cons.fill=GridBagConstraints.BOTH;
  _cons.weightx=1;
  _cons.weighty=1;
  _cons.insets=new Insets(5,5,5,5);
  _textPane=new JTextArea();
  _textPane.setEditable(false);
  _textPane.setAutoscrolls(true);
  this.add(new JScrollPane(_textPane,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),_cons);
}
 

Example 45

From project pegadi, under directory /storysketch/src/main/java/org/pegadi/storysketch/views/.

Source file: AppointmentView.java

  17 
vote

private void makeLabel(Component comp,JPanel p,GridBagLayout gridbag,GridBagConstraints c){
  c.gridwidth=1;
  c.anchor=GridBagConstraints.EAST;
  c.insets=new Insets(3,3,3,3);
  gridbag.setConstraints(comp,c);
  p.add(comp);
}
 

Example 46

From project pomodoro4nb, under directory /src/org/matveev/pomodoro4nb/controls/.

Source file: RolloverButton.java

  17 
vote

@Override public void updateUI(){
  super.updateUI();
  setBorderPainted(false);
  setRequestFocusEnabled(false);
  setMargin(new Insets(1,1,1,1));
}
 

Example 47

From project project_bpm, under directory /Processing/libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  17 
vote

private void launch(){
  GraphicsDevice displayDevice=null;
  if (displayDevice == null) {
    GraphicsEnvironment environment=GraphicsEnvironment.getLocalGraphicsEnvironment();
    displayDevice=environment.getDefaultScreenDevice();
  }
  frame=new Frame(displayDevice.getDefaultConfiguration());
  frame.setResizable(false);
  init();
  frame.pack();
  frame.setLocation(x,y);
  Insets insets=frame.getInsets();
  int windowW=Math.max(width,MIN_WINDOW_WIDTH) + insets.left + insets.right;
  int windowH=Math.max(height,MIN_WINDOW_HEIGHT) + insets.top + insets.bottom;
  frame.setSize(windowW,windowH);
  frame.setLayout(null);
  frame.add(this);
  frame.setBackground(Color.black);
  int usableWindowH=windowH - insets.top - insets.bottom;
  setBounds((windowW - width) / 2,insets.top + (usableWindowH - height) / 2,width,height);
  frame.addWindowListener(this);
  frame.addComponentListener(this);
  frame.setName(_myName);
  frame.setTitle(_myName + " x:" + x+ " y:"+ y+ "   w:"+ width+ " h:"+ height);
  frame.setVisible(true);
  requestFocus();
}
 

Example 48

From project RomRaider, under directory /src/com/romraider/logger/ecu/ui/swing/layout/.

Source file: BetterFlowLayout.java

  17 
vote

public Dimension betterPreferredSize(Container target){
synchronized (target.getTreeLock()) {
    Insets insets=target.getInsets();
    int maxwidth=target.getWidth() - (insets.left + insets.right + getHgap() * 2);
    int nmembers=target.getComponentCount();
    int x=0, y=insets.top + getVgap();
    int rowh=0;
    for (int i=0; i < nmembers; i++) {
      Component m=target.getComponent(i);
      if (m.isVisible()) {
        Dimension d=m.getPreferredSize();
        m.setSize(d.width,d.height);
        if ((x == 0) || ((x + d.width) <= maxwidth)) {
          if (x > 0)           x+=getHgap();
          x+=d.width;
          rowh=Math.max(rowh,d.height);
        }
 else {
          x=d.width;
          y+=getVgap() + rowh;
          rowh=d.height;
        }
      }
    }
    return new Dimension(maxwidth,y + rowh + getVgap());
  }
}
 

Example 49

From project saiku-adhoc, under directory /saiku-adhoc-core/src/main/java/org/saiku/adhoc/utils/.

Source file: TemplateUtils.java

  17 
vote

public static void mergePageSetup(SaikuMasterModel model,MasterReport output){
  Paper paper=null;
  SaikuReportSettings settings=model.getSettings();
  if (settings.getPageFormat() == null) {
    paper=output.getPageDefinition().getPageFormat(0).getPaper();
    settings.setPageFormat(PageFormatFactory.getInstance().getPageFormatName(paper.getWidth(),paper.getHeight()));
  }
 else {
    paper=PageFormatFactory.getInstance().createPaper(settings.getPageFormat());
  }
  PageFormat pageFormat=null;
  if (settings.getOrientation() == null) {
    settings.setOrientation(output.getPageDefinition().getPageFormat(0).getOrientation());
    pageFormat=output.getPageDefinition().getPageFormat(0);
  }
 else {
    int orientation=settings.getOrientation();
    pageFormat=PageFormatFactory.getInstance().createPageFormat(paper,orientation);
  }
  if (settings.getMarginBottom() == null || settings.getMarginLeft() == null || settings.getMarginRight() == null || settings.getMarginTop() == null) {
    Insets insets=PageFormatFactory.getInstance().getPageMargins(output.getPageDefinition().getPageFormat(0));
    settings.setMarginBottom(insets.bottom);
    settings.setMarginLeft(insets.left);
    settings.setMarginTop(insets.top);
    settings.setMarginRight(insets.right);
  }
 else {
    Insets insets=new Insets(settings.getMarginTop(),settings.getMarginLeft(),settings.getMarginBottom(),settings.getMarginRight());
    PageFormatFactory.getInstance().setPageMargins(pageFormat,insets);
  }
  PageDefinition format=new SimplePageDefinition(pageFormat);
  output.setPageDefinition(format);
}
 

Example 50

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.

Source file: AddisWindow.java

  16 
vote

public boolean deleteEntity(final Entity selected,final boolean confirmation){
  String selectedType=getEntityKnowledge(selected).getSingularCapitalized();
  if (confirmation) {
    int conf=JOptionPane.showConfirmDialog(this,"Do you really want to delete " + selectedType + " "+ selected+ " ?","Confirm deletion",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,MainWindow.IMAGELOADER.getIcon(org.drugis.mtc.gui.FileNames.ICON_DELETE));
    if (conf != JOptionPane.YES_OPTION) {
      return false;
    }
  }
  try {
    getDomain().deleteEntity(selected);
  }
 catch (  DependentEntitiesException e) {
    String str=new String(selected + " is used by: ");
    for (    Entity en : e.getDependents()) {
      str+="\n\t" + en;
    }
    str+="\n - delete these first.";
    JTextArea text=new JTextArea(str);
    text.setWrapStyleWord(true);
    text.setLineWrap(true);
    text.setMargin(new Insets(5,5,5,5));
    JScrollPane sp=new JScrollPane(text);
    sp.setPreferredSize(new Dimension(300,200));
    JOptionPane.showMessageDialog(this,sp,"Error deleting " + selected,JOptionPane.ERROR_MESSAGE);
  }
  return true;
}
 

Example 51

From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.

Source file: IcolForm.java

  16 
vote

private JPanel createCTPPanel(){
  TableLayout layout=new TableLayout(3);
  layout.setTableAnchor(TableLayout.Anchor.WEST);
  layout.setTableFill(TableLayout.Fill.HORIZONTAL);
  layout.setColumnWeightX(0,0.1);
  layout.setColumnWeightX(1,0.1);
  layout.setColumnWeightX(2,1);
  layout.setCellColspan(0,0,3);
  layout.setCellColspan(1,0,3);
  layout.setTablePadding(2,2);
  layout.setCellPadding(2,0,new Insets(0,24,0,0));
  layout.setCellPadding(3,0,new Insets(0,24,0,0));
  JPanel panel=new JPanel(layout);
  panel.setBorder(BorderFactory.createTitledBorder("Cloud Top Pressure"));
  ctpGroup=new ButtonGroup();
  icolCtp=new JRadioButton("Compute by algorithm");
  icolCtp.setSelected(true);
  panel.add(icolCtp);
  ctpGroup.add(icolCtp);
  userCtp=new JRadioButton("Use constant value");
  userCtp.setSelected(false);
  panel.add(userCtp);
  ctpGroup.add(userCtp);
  ctpValue=new JFormattedTextField("1013.0");
  userCtpLabel=new JLabel("CTP: ");
  panel.add(userCtpLabel);
  panel.add(ctpValue);
  panel.add(new JPanel());
  ActionListener ctpActionListener=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      updateCtpUIstate();
    }
  }
;
  icolCtp.addActionListener(ctpActionListener);
  userCtp.addActionListener(ctpActionListener);
  return panel;
}
 

Example 52

From project Calendar-Application, under directory /calendar/.

Source file: EventPanel.java

  16 
vote

public EventPanel(Event e,ActionListener CalListener){
  setLayout(new GridBagLayout());
  m_id=e.GetId();
  m_text=e.GetTitle();
  m_text_label=new JLabel(m_text);
  m_edit_button=new JButton(new ImageIcon(getClass().getResource("/images/edit_15.png")));
  m_edit_button.setToolTipText("edit");
  m_delete_button=new JButton(new ImageIcon(getClass().getResource("/images/delete_15.png")));
  m_delete_button.setToolTipText("delete");
  m_edit_button.setMargin(new Insets(0,0,0,0));
  m_edit_button.setBorder(null);
  m_delete_button.setMargin(new Insets(0,0,0,0));
  m_delete_button.setBorder(null);
  m_delete_button.addActionListener(CalListener);
  m_edit_button.addActionListener(CalListener);
  m_edit_button.setName("" + m_id);
  m_delete_button.setName("" + m_id);
  m_border=new EtchedBorder(EtchedBorder.LOWERED);
  m_edit_button.setVisible(false);
  m_delete_button.setVisible(false);
  GridBagConstraints c=new GridBagConstraints();
  c.anchor=GridBagConstraints.NORTHWEST;
  c.fill=GridBagConstraints.VERTICAL;
  c.weightx=0;
  c.gridx=0;
  c.gridy=0;
  c.ipadx=10;
  add(m_edit_button,c);
  c.gridx++;
  add(m_delete_button,c);
  c.gridx++;
  c.anchor=GridBagConstraints.NORTHEAST;
  c.fill=GridBagConstraints.NONE;
  c.weightx=0;
  add(m_text_label,c);
  setBackground(Color.white);
  addMouseListener(this);
  m_edit_button.addMouseListener(this);
  m_delete_button.addMouseListener(this);
}
 

Example 53

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/family/.

Source file: FamilyWindow.java

  16 
vote

private JPanel getRepositoryPanel(){
  JPanel panel=new JPanel();
  panel.setLayout(new GridBagLayout());
  GridBagConstraints gridBagConstraints1=new GridBagConstraints();
  gridBagConstraints1.gridy=0;
  gridBagConstraints1.ipadx=0;
  gridBagConstraints1.insets=new Insets(10,10,5,1);
  gridBagConstraints1.gridx=0;
  GridBagConstraints gridBagConstraints2=new GridBagConstraints();
  gridBagConstraints2.gridy=0;
  gridBagConstraints2.ipadx=100;
  gridBagConstraints2.fill=GridBagConstraints.NONE;
  gridBagConstraints2.insets=new Insets(10,6,5,0);
  gridBagConstraints2.gridx=1;
  repositoryComboBox.loadData();
  try {
    repositoryComboBox.setSelectedItem(GuiContextUtils.getCurrentRepository(ctxt));
  }
 catch (  Exception ex) {
    ;
  }
  panel.add(new JLabel("R??entiel:"),gridBagConstraints1);
  panel.add(repositoryComboBox,gridBagConstraints2);
  return panel;
}
 

Example 54

From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/.

Source file: MemoryPanel.java

  16 
vote

/** 
 */
void jbInit(){
  forceGCButton.setText("Forcer GC");
  forceGCButton.addActionListener(new java.awt.event.ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      forceGCButton_actionPerformed(evt);
    }
  }
);
  memoryLabel.setToolTipText("");
  memoryLabel.setEditable(false);
  memoryLabel.setMargin(new Insets(0,10,0,10));
  memoryLabel.setText("xx / xx");
  memoryLabel.setColumns(15);
  memoryLabel.setHorizontalAlignment(SwingConstants.CENTER);
  jLabel1.setText("M?oire : ");
  this.add(jLabel1,null);
  this.add(memoryLabel,null);
  this.add(forceGCButton,null);
}
 

Example 55

From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/calendar/.

Source file: JDayChooser.java

  16 
vote

/** 
 * Default JDayChooser constructor.
 */
public JDayChooser(){
  locale=Locale.getDefault();
  days=new JButton[49];
  selectedDay=null;
  Calendar calendar=Calendar.getInstance(locale);
  today=(Calendar)calendar.clone();
  setLayout(new GridLayout(7,7));
  for (int y=0; y < 7; y++) {
    for (int x=0; x < 7; x++) {
      int index=x + 7 * y;
      if (y == 0) {
        days[index]=new JButton(){
          public void addMouseListener(          MouseListener l){
          }
          public boolean isFocusTraversable(){
            return false;
          }
        }
;
        days[index].setBackground(new Color(180,180,200));
      }
 else {
        days[index]=new JButton("x");
        days[index].addActionListener(this);
        days[index].addKeyListener(this);
        days[index].addFocusListener(this);
        days[index].addMouseListener(this);
      }
      days[index].setMargin(new Insets(0,0,0,0));
      days[index].setFocusPainted(false);
      add(days[index]);
    }
  }
  init();
  setDay(Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
  initialized=true;
}
 

Example 56

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/nurserostering/swingui/.

Source file: EmployeePanel.java

  16 
vote

public void addShiftAssignment(ShiftAssignment shiftAssignment){
  Shift shift=shiftAssignment.getShift();
  JPanel shiftPanel=shiftPanelMap.get(shift);
  JButton shiftAssignmentButton=new JButton(new ShiftAssignmentAction(shiftAssignment));
  shiftAssignmentButton.setEnabled(shiftPanel.isEnabled());
  shiftAssignmentButton.setMargin(new Insets(0,0,0,0));
  if (employee != null) {
    if (employee.getDayOffRequestMap().containsKey(shift.getShiftDate()) || employee.getShiftOffRequestMap().containsKey(shift)) {
      shiftAssignmentButton.setForeground(TangoColors.SCARLET_1);
    }
  }
  int colorIndex=shift.getShiftType().getIndex() % TangoColors.SEQUENCE_1.length;
  shiftAssignmentButton.setBackground(TangoColors.SEQUENCE_1[colorIndex]);
  shiftAssignmentButton.setToolTipText((employee == null ? "Unassigned" : employee.getLabel()) + " on " + shift.getLabel());
  shiftPanel.add(shiftAssignmentButton);
  shiftPanel.repaint();
  shiftAssignmentButtonMap.put(shiftAssignment,shiftAssignmentButton);
}
 

Example 57

From project harmony, under directory /phosphorus-gmpls/src/main/java/org/opennaas/extensions/gmpls/client/views/.

Source file: GmplsShowPathPanel.java

  16 
vote

/** 
 * Initializes this Panel.
 */
private void initialize(){
  GridBagConstraints gridBagConstraints3=new GridBagConstraints();
  gridBagConstraints3.gridx=0;
  gridBagConstraints3.insets=new Insets(5,25,5,5);
  gridBagConstraints3.weightx=0.5D;
  gridBagConstraints3.gridy=2;
  GridBagConstraints gridBagConstraints2=new GridBagConstraints();
  gridBagConstraints2.gridx=1;
  gridBagConstraints2.insets=new Insets(5,5,5,25);
  gridBagConstraints2.weightx=0.5D;
  gridBagConstraints2.gridy=2;
  GridBagConstraints gridBagConstraints1=new GridBagConstraints();
  gridBagConstraints1.fill=GridBagConstraints.BOTH;
  gridBagConstraints1.gridy=1;
  gridBagConstraints1.weightx=1.0;
  gridBagConstraints1.weighty=1.0;
  gridBagConstraints1.gridwidth=2;
  gridBagConstraints1.insets=new Insets(5,5,5,5);
  gridBagConstraints1.gridx=0;
  GridBagConstraints gridBagConstraints=new GridBagConstraints();
  gridBagConstraints.gridx=0;
  gridBagConstraints.anchor=GridBagConstraints.WEST;
  gridBagConstraints.insets=new Insets(2,2,2,2);
  gridBagConstraints.gridwidth=2;
  gridBagConstraints.gridy=0;
  this.lblTitle=new JLabel();
  this.lblTitle.setText("Show / Delete Paths");
  this.lblTitle.setFont(new Font("Dialog",Font.BOLD,24));
  this.setLayout(new GridBagLayout());
  this.setSize(new Dimension(620,354));
  this.add(this.lblTitle,gridBagConstraints);
  this.add(getScrollInfo(),gridBagConstraints1);
  this.add(getCmdDelete(),gridBagConstraints2);
  this.add(getCmdRefresh(),gridBagConstraints3);
}
 

Example 58

From project jCAE, under directory /jcae/mesh-algos/src/org/jcae/netbeans/mesh/.

Source file: ExportGroupAction.java

  16 
vote

public ChooseUnitPanel(){
  setLayout(new GridBagLayout());
  setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.anchor=GridBagConstraints.WEST;
  add(new JLabel("Unit:"),gbc);
  gbc=new GridBagConstraints();
  gbc.gridy=1;
  add(unitCombo,gbc);
  gbc=new GridBagConstraints();
  gbc.gridy=2;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  gbc.insets=new Insets(5,5,5,5);
  add(new JSeparator(),gbc);
  gbc=new GridBagConstraints();
  gbc.gridy=3;
  gbc.anchor=GridBagConstraints.WEST;
  add(new JLabel("Scale:"),gbc);
  gbc=new GridBagConstraints();
  gbc.gridy=4;
  gbc.anchor=GridBagConstraints.NORTH;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  gbc.weightx=1.0;
  gbc.weighty=1.0;
  add(scaleField,gbc);
  scaleField.setFormatterFactory(DoubleFormatter.FACTORY);
}
 

Example 59

From project jchempaint, under directory /src/main/org/openscience/jchempaint/dialog/.

Source file: FieldTablePanel.java

  16 
vote

/** 
 * Adds a new JComponent to the 2 column table layout. Both elements will be layed out in the same row. For larger <code>JComponent</code>s the addArea() can be used.
 * @param labelText The text in left column.
 * @param component The control to add.
 * @param panel     The panel to add to. This must be either a panel you got from addTab or null if in no tab mode.
 * @param inset     Spacing distance between objects on the panel 
 */
public void addField(String labelText,JComponent component,JPanel panel,int inset){
  if (panel == null)   panel=this;
  rows++;
  GridBagConstraints constraints=new GridBagConstraints();
  constraints.insets=new Insets(inset,inset,inset,inset);
  JLabel label=new JLabel("",JLabel.TRAILING);
  if (labelText != null && labelText.length() > 0) {
    label=new JLabel(labelText + ": ",JLabel.TRAILING);
  }
  label.setLabelFor(component);
  constraints.gridx=0;
  constraints.gridy=rows;
  constraints.fill=GridBagConstraints.HORIZONTAL;
  constraints.anchor=GridBagConstraints.LINE_START;
  constraints.weightx=1.0;
  panel.add(label,constraints);
  constraints.gridx=1;
  constraints.fill=GridBagConstraints.HORIZONTAL;
  panel.add(component,constraints);
}
 

Example 60

From project LanguageSpecCreator, under directory /src/SpecificationCreation/.

Source file: SpecificationCreator.java

  16 
vote

/** 
 * Creates the initial welcome and starting screen
 */
private void init(Container c){
  topMenu=new JMenuBar();
  JMenu fileMenu=new JMenu("File");
  fileMenu.setMnemonic(KeyEvent.VK_ALT);
  topMenu.add(fileMenu);
  newItem=new JMenuItem("New project",KeyEvent.VK_N);
  newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,ActionEvent.CTRL_MASK));
  newItem.addActionListener(this);
  fileMenu.add(newItem);
  openItem=new JMenuItem("Open project",KeyEvent.VK_O);
  openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,ActionEvent.CTRL_MASK));
  openItem.addActionListener(this);
  fileMenu.add(openItem);
  saveItem=new JMenuItem("Save project",KeyEvent.VK_S);
  saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,ActionEvent.CTRL_MASK));
  saveItem.addActionListener(this);
  fileMenu.add(saveItem);
  exitItem=new JMenuItem("Exit",KeyEvent.VK_Q);
  exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,ActionEvent.CTRL_MASK));
  exitItem.addActionListener(this);
  fileMenu.add(exitItem);
  setJMenuBar(topMenu);
  GridBagConstraints constraint=new GridBagConstraints();
  JTextArea area=new JTextArea("Welcome to the LIBER ontology preparation tool. " + "Please open an existing project, or start a new project by uploading the ontology you wish to adapt for use in LIBER.");
  area.setEditable(false);
  area.setLineWrap(true);
  area.setWrapStyleWord(true);
  constraint.insets=new Insets(0,10,10,0);
  constraint.anchor=GridBagConstraints.CENTER;
  constraint.gridx=0;
  constraint.gridy=0;
  c.add(area,constraint);
}
 

Example 61

From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/.

Source file: MedSavantClient.java

  16 
vote

private static void setLAF(){
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    if (MiscUtils.WINDOWS) {
      LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE_WITHOUT_MENU);
    }
    UIManager.put("TabbedPane.contentBorderInsets",new Insets(0,0,0,0));
    UIManager.put("ToolTip.background",new ColorUIResource(255,255,255));
    ToolTipManager.sharedInstance().setDismissDelay(8000);
    ToolTipManager.sharedInstance().setInitialDelay(500);
  }
 catch (  Exception x) {
    LOG.error("Unable to install look & feel.",x);
  }
}
 

Example 62

From project Moneychanger, under directory /src/main/java/com/moneychanger/ui/custom/.

Source file: DateField.java

  16 
vote

/** 
 * Initializes the panel components.
 */
private void init(){
  setLayout(new AbsoluteLayout());
  dateText.setText("");
  dateText.setEditable(false);
  dateText.setBackground(new Color(255,255,255));
  add(dateText,new AbsoluteConstraints(10,10,141,20));
  dropdownButton.setText("...");
  dropdownButton.setMargin(new Insets(2,2,2,2));
  dropdownButton.addActionListener(new ActionListener(){
    public void actionPerformed(    final ActionEvent evt){
      onButtonClick(evt);
    }
  }
);
  add(dropdownButton,new AbsoluteConstraints(151,10,20,21));
}
 

Example 63

From project nuxeo-distribution, under directory /nuxeo-launcher/src/main/java/org/nuxeo/launcher/gui/.

Source file: NuxeoFrame.java

  16 
vote

public NuxeoFrame(NuxeoLauncherGUI controller) throws HeadlessException {
  super("NuxeoCtl");
  this.setController(controller);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  setIconImage(appIcon.getImage());
  getContentPane().setBackground(new Color(55,55,55));
  getContentPane().setLayout(new GridBagLayout());
  constraints=new GridBagConstraints();
  constraints.fill=GridBagConstraints.HORIZONTAL;
  constraints.gridx=0;
  constraints.anchor=GridBagConstraints.PAGE_START;
  JComponent header=buildHeader();
  header.setPreferredSize(new Dimension(480,110));
  getContentPane().add(header,constraints);
  constraints.fill=GridBagConstraints.BOTH;
  constraints.ipady=100;
  constraints.weightx=1.0;
  constraints.weighty=1.0;
  getContentPane().add(buildTabbedPanel(),constraints);
  constraints.fill=GridBagConstraints.NONE;
  constraints.anchor=GridBagConstraints.PAGE_END;
  constraints.ipady=0;
  constraints.weightx=0;
  constraints.weighty=0;
  constraints.insets=new Insets(10,0,0,0);
  getContentPane().add(buildFooter(),constraints);
}
 

Example 64

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.

Source file: BroadcastFileContentsDetailWindow.java

  15 
vote

private void initGui() throws Exception {
  this.setResizable(true);
  this.getContentPane().setBackground(UIManager.getColor("Panel.background"));
  this.setPreferredSize(new Dimension(430,430));
  this.getContentPane().setLayout(borderLayout1);
  mainPanel.setLayout(gridBagLayout3);
  columnPanel.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(142,142,142)),""));
  columnPanel.setLayout(gridBagLayout2);
  columnSeparator.setMaxTextLength(2);
  sectionPanel.setLayout(gridBagLayout1);
  sectionPosition.setColumns(0);
  headerPanel.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(134,134,134)),""));
  headerPanel.setLayout(new BorderLayout());
  headerPanel.add(headerScrollPane,BorderLayout.CENTER);
  dataSource.addDataSourceListener(new net.codjo.mad.gui.request.event.DataSourceAdapter(){
    @Override public void saveEvent(    DataSourceEvent event){
      dataSourceSaveEvent();
    }
  }
);
  sectionTabPanel.setName("tabPanel");
  this.getContentPane().add(sectionTabPanel,BorderLayout.CENTER);
  this.getContentPane().add(buttonPanelLogic.getGui(),BorderLayout.SOUTH);
  sectionTabPanel.add(mainPanel,"Section");
  columnPanel.add(separatorLabel,new GridBagConstraints(0,0,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,5,5,0),0,0));
  columnPanel.add(columnSeparator,new GridBagConstraints(1,0,1,1,1.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(0,5,5,0),51,0));
  columnPanel.add(columnHeader,new GridBagConstraints(2,0,1,1,0.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(0,18,5,165),0,0));
  sectionPanel.add(sectionNameLabel,new GridBagConstraints(0,0,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(10,5,0,12),8,0));
  sectionPanel.add(sectionId,new GridBagConstraints(1,0,2,1,1.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,new Insets(10,5,0,10),181,0));
  sectionPanel.add(positionLabel,new GridBagConstraints(0,1,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(10,5,0,0),0,0));
  sectionPanel.add(sectionPosition,new GridBagConstraints(1,1,1,1,1.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(10,5,0,0),30,0));
  sectionPanel.add(sectionHeader,new GridBagConstraints(2,1,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(10,92,0,10),0,0));
  sectionPanel.add(headerPanel,new GridBagConstraints(0,2,3,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(10,5,5,5),0,0));
  mainPanel.add(columnPanel,new GridBagConstraints(0,1,1,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,9),-5,0));
  headerScrollPane.getViewport().add(sectionHeaderText,null);
  mainPanel.add(sectionPanel,new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,9),4,54));
}
 

Example 65

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/.

Source file: VCRP.java

  15 
vote

private void jbInit() throws Exception {
  northPanel.setLayout(new java.awt.GridBagLayout());
  resourceLabel.setText(Msg.translate(Env.getCtx(),"S_Resource_ID"));
  northPanel.add(resourceLabel,new GridBagConstraints(0,1,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(5,5,5,5),0,0));
  northPanel.add(resource,new GridBagConstraints(1,1,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0));
  dateFromLabel.setText(Msg.translate(Env.getCtx(),"DateFrom"));
  northPanel.add(dateFromLabel,new GridBagConstraints(2,1,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(5,5,5,5),0,0));
  northPanel.add(dateFrom,new GridBagConstraints(3,1,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0));
  chartPanel.setPreferredSize(new Dimension(750,550));
  centerPanel.add(chartPanel,BorderLayout.CENTER);
  confirmPanel.addActionListener(this);
}
 

Example 66

From project ib-ruby, under directory /misc/IBJts-965/java/TestJavaClient/.

Source file: IBGridBagPanel.java

  15 
vote

private void addToPane(Component c,int x,int y,int w,int h,int xGrow,int yGrow,int anchor,int fill,Insets insets){
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=x;
  gbc.gridy=y;
  gbc.gridwidth=w;
  gbc.gridheight=h;
  gbc.weightx=xGrow;
  gbc.weighty=yGrow;
  gbc.fill=fill;
  gbc.anchor=anchor;
  gbc.insets=insets;
  add(c,gbc);
}
 

Example 67

From project JGit, under directory /org.spearce.jgit/src/org/spearce/jgit/transport/.

Source file: DefaultSshSessionFactory.java

  15 
vote

public String[] promptKeyboardInteractive(final String destination,final String name,final String instruction,final String[] prompt,final boolean[] echo){
  final GridBagConstraints gbc=new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0);
  final Container panel=new JPanel();
  panel.setLayout(new GridBagLayout());
  gbc.weightx=1.0;
  gbc.gridwidth=GridBagConstraints.REMAINDER;
  gbc.gridx=0;
  panel.add(new JLabel(instruction),gbc);
  gbc.gridy++;
  gbc.gridwidth=GridBagConstraints.RELATIVE;
  final JTextField[] texts=new JTextField[prompt.length];
  for (int i=0; i < prompt.length; i++) {
    gbc.fill=GridBagConstraints.NONE;
    gbc.gridx=0;
    gbc.weightx=1;
    panel.add(new JLabel(prompt[i]),gbc);
    gbc.gridx=1;
    gbc.fill=GridBagConstraints.HORIZONTAL;
    gbc.weighty=1;
    if (echo[i]) {
      texts[i]=new JTextField(20);
    }
 else {
      texts[i]=new JPasswordField(20);
    }
    panel.add(texts[i],gbc);
    gbc.gridy++;
  }
  if (JOptionPane.showConfirmDialog(null,panel,destination + ": " + name,JOptionPane.OK_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
    String[] response=new String[prompt.length];
    for (int i=0; i < prompt.length; i++) {
      response[i]=texts[i].getText();
    }
    return response;
  }
  return null;
}
 

Example 68

From project jSite, under directory /src/main/java/de/todesbaum/jsite/gui/.

Source file: ProjectInsertPage.java

  15 
vote

/** 
 * Creates the main panel.
 * @return The main panel
 */
private JComponent createProjectInsertPanel(){
  JComponent projectInsertPanel=new JPanel(new GridBagLayout());
  requestURITextField=new JTextField();
  requestURITextField.setEditable(false);
  startTimeLabel=new JLabel();
  progressBar=new JProgressBar(0,1);
  progressBar.setStringPainted(true);
  progressBar.setValue(0);
  final JLabel projectInformationLabel=new JLabel("<html><b>" + I18n.getMessage("jsite.insert.project-information") + "</b></html>");
  projectInsertPanel.add(projectInformationLabel,new GridBagConstraints(0,0,2,1,1.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(0,0,0,0),0,0));
  final JLabel requestURILabel=new JLabel(I18n.getMessage("jsite.insert.request-uri") + ":");
  projectInsertPanel.add(requestURILabel,new GridBagConstraints(0,1,1,1,0.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(6,18,0,0),0,0));
  projectInsertPanel.add(requestURITextField,new GridBagConstraints(1,1,1,1,1.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(6,6,0,0),0,0));
  final JLabel startTimeLeftLabel=new JLabel(I18n.getMessage("jsite.insert.start-time") + ":");
  projectInsertPanel.add(startTimeLeftLabel,new GridBagConstraints(0,2,1,1,0.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(6,18,0,0),0,0));
  projectInsertPanel.add(startTimeLabel,new GridBagConstraints(1,2,1,1,1.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(6,6,0,0),0,0));
  final JLabel progressLabel=new JLabel(I18n.getMessage("jsite.insert.progress") + ":");
  projectInsertPanel.add(progressLabel,new GridBagConstraints(0,3,1,1,0.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(6,18,0,0),0,0));
  projectInsertPanel.add(progressBar,new GridBagConstraints(1,3,1,1,1.0,0.0,GridBagConstraints.LINE_START,GridBagConstraints.HORIZONTAL,new Insets(6,6,0,0),0,0));
  projectInsertPanel.add(new JButton(copyURIAction),new GridBagConstraints(0,4,2,1,0.0,0.0,GridBagConstraints.LINE_END,GridBagConstraints.NONE,new Insets(12,18,0,0),0,0));
  I18nContainer.getInstance().registerRunnable(new Runnable(){
    @Override @SuppressWarnings("synthetic-access") public void run(){
      projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.insert.project-information") + "</b></html>");
      requestURILabel.setText(I18n.getMessage("jsite.insert.request-uri") + ":");
      startTimeLeftLabel.setText(I18n.getMessage("jsite.insert.start-time") + ":");
      if (startTime != 0) {
        startTimeLabel.setText(DateFormat.getDateTimeInstance().format(new Date(startTime)));
      }
 else {
        startTimeLabel.setText("");
      }
      progressLabel.setText(I18n.getMessage("jsite.insert.progress") + ":");
    }
  }
);
  return projectInsertPanel;
}
 

Example 69

From project kabeja, under directory /blocks/svg/src/main/java/org/kabeja/svg/ui/.

Source file: OutputSettingsUI.java

  15 
vote

protected GridBagConstraints createConstraints(int x,int y,int width,int height,int fill,int anchor,Insets insets){
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=x;
  gbc.gridy=y;
  gbc.gridwidth=width;
  gbc.gridheight=height;
  gbc.fill=fill;
  gbc.anchor=anchor;
  gbc.ipadx=9;
  gbc.ipady=6;
  if (fill != GridBagConstraints.NONE) {
    gbc.weightx=100;
  }
  gbc.weighty=0;
  gbc.insets=insets;
  return gbc;
}
 

Example 70

From project multibit, under directory /src/main/java/org/multibit/viewsystem/swing/view/.

Source file: AbstractTradePanel.java

  15 
vote

public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){
  label.setHorizontalAlignment(SwingConstants.LEADING);
  label.setOpaque(true);
  label.setBorder(new EmptyBorder(new Insets(1,TABLE_BORDER,1,TABLE_BORDER)));
  label.setText((String)value);
  if (isSelected) {
    label.setBackground(table.getSelectionBackground());
    label.setForeground(table.getSelectionForeground());
  }
 else {
    Color backgroundColor=(row % 2 == 0 ? Color.WHITE : MultiBitFrame.BACKGROUND_COLOR);
    label.setBackground(backgroundColor);
    label.setForeground(table.getForeground());
  }
  return label;
}