Java Code Examples for java.awt.BorderLayout#CENTER

The following examples show how to use java.awt.BorderLayout#CENTER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTaskPaneGroup.java    From orbit-image-analysis with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new empty <code>JTaskPaneGroup</code>.
 */
public JTaskPaneGroup() {
  collapsePane = new JCollapsiblePane();
  super.setLayout(new BorderLayout(0, 0));
  super.addImpl(collapsePane, BorderLayout.CENTER, -1);
  
  updateUI();
  setFocusable(true);
  setOpaque(false);

  // disable animation if specified in UIManager
  setAnimated(!Boolean.FALSE.equals(UIManager.get("TaskPaneGroup.animate")));
  
  // listen for animation events and forward them to registered listeners
  collapsePane.addPropertyChangeListener(
    JCollapsiblePane.ANIMATION_STATE_KEY, new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        JTaskPaneGroup.this.firePropertyChange(evt.getPropertyName(), evt
          .getOldValue(), evt.getNewValue());
      }
    });
}
 
Example 2
Source File: AboutDialog.java    From Girinoscope with Apache License 2.0 6 votes vote down vote up
public AboutDialog(JFrame owner) {
    super(owner, true);
    super.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    super.setLayout(new BorderLayout());
    super.setBackground(Color.WHITE);

    try {
        HtmlPane htmlPane = new HtmlPane(AboutDialog.class.getResource("about.html"));
        htmlPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
        htmlPane.setOpaque(true);
        super.add(htmlPane, BorderLayout.CENTER);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    super.pack();
    super.setLocationRelativeTo(owner);
    super.setResizable(false);

    DialogHelper.installEscapeCloseOperation(AboutDialog.this);
}
 
Example 3
Source File: CustomAxisEditionDialog.java    From Girinoscope with Apache License 2.0 6 votes vote down vote up
private CustomAxisEditionDialog(JFrame owner, Axis.Builder axisBuilder) {
    super(owner, true);
    this.axisBuilder = axisBuilder;

    super.setTitle("Y Axis parameters");
    super.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    super.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            CustomAxisEditionDialog.this.axisBuilder = null;
        }
    });

    super.setLayout(new BorderLayout());
    super.setBackground(Color.WHITE);
    super.add(createEditorPane(), BorderLayout.CENTER);
    super.add(createButtonBar(cancelAction, applyAction), BorderLayout.SOUTH);

    super.pack();
    super.setLocationRelativeTo(owner);
    super.setResizable(false);

    DialogHelper.installEscapeCloseOperation(CustomAxisEditionDialog.this);
}
 
Example 4
Source File: ConstantParser.java    From osp with GNU General Public License v3.0 6 votes vote down vote up
static public Value constraintsConstant(String _value) {
  _value = _value.trim().toLowerCase();
  if(_value.equals("north")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.NORTH);
  }
  if(_value.equals("south")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.SOUTH);
  }
  if(_value.equals("east")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.EAST);
  }
  if(_value.equals("west")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.WEST);
  }
  if(_value.equals("center")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.CENTER);
  }
  return new StringValue(BorderLayout.CENTER);
}
 
Example 5
Source File: JCollapsiblePane.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the content pane of this JCollapsiblePane. Components must be added
 * to this content pane, not to the JCollapsiblePane.
 * 
 * @param contentPanel
 * @throws IllegalArgumentException
 *           if contentPanel is null
 */
public void setContentPane(Container contentPanel) {
  if (contentPanel == null) {
    throw new IllegalArgumentException("Content pane can't be null");
  }
  
  if (wrapper != null) {
    super.remove(wrapper);
  }
  wrapper = new WrapperContainer(contentPanel);
  super.addImpl(wrapper, BorderLayout.CENTER, -1);
}
 
Example 6
Source File: JCollapsiblePane.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the content pane of this JCollapsiblePane. Components must be added
 * to this content pane, not to the JCollapsiblePane.
 * 
 * @param contentPanel
 * @throws IllegalArgumentException
 *           if contentPanel is null
 */
public void setContentPane(Container contentPanel) {
  if (contentPanel == null) {
    throw new IllegalArgumentException("Content pane can't be null");
  }
  
  if (wrapper != null) {
    super.remove(wrapper);
  }
  wrapper = new WrapperContainer(contentPanel);
  super.addImpl(wrapper, BorderLayout.CENTER, -1);
}
 
Example 7
Source File: ConnectDialog.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Labeled(final String label, final Font font, final Component toBeLabeled){
    this.comp = toBeLabeled;
    this.leftLabel = new JLabel(label);
    if(font!=null)
        this.leftLabel.setFont(font);

    super.setLayout(new BorderLayout(6,6));
    super.add(leftLabel,BorderLayout.WEST);
    super.add(comp,BorderLayout.CENTER);
}
 
Example 8
Source File: TabbedTableView.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getDefaultPosition() {
    return BorderLayout.CENTER;
}
 
Example 9
Source File: Navigator.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getDefaultPosition() {
    return BorderLayout.CENTER;
}
 
Example 10
Source File: JavaWindowsView.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
MarginContainer(Component comp, int top, int left, int bottom, int right) {
    this(comp, BorderLayout.CENTER, top, left, bottom, right);
}
 
Example 11
Source File: UI.java    From Girinoscope with Apache License 2.0 4 votes vote down vote up
public UI() {
    super.setTitle("Girinoscope");

    List<Image> icons = new LinkedList<>();
    for (int i = 256; i >= 16; i /= 2) {
        icons.add(Icon.getImage("icon-" + i + ".png"));
    }
    super.setIconImages(icons);

    super.setLayout(new BorderLayout());

    graphPane = new GraphPane();
    graphPane.setYCoordinateSystem(yAxisBuilder.build());
    graphPane.setPreferredSize(new Dimension(800, 600));
    super.add(graphPane, BorderLayout.CENTER);

    super.setJMenuBar(createMenuBar());

    super.add(createToolBar(), BorderLayout.NORTH);

    statusBar = new StatusBar();
    super.add(statusBar, BorderLayout.SOUTH);

    stopAcquiringAction.setEnabled(false);
    exportLastFrameAction.setEnabled(false);

    if (port != null) {
        startAcquiringAction.setEnabled(true);
        startAcquiringInLoopAction.setEnabled(true);
    } else {
        startAcquiringAction.setEnabled(false);
        startAcquiringInLoopAction.setEnabled(false);
        setStatus("red", "No USB to serial adaptation port detected.");
    }

    super.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            settings.save();
        }
    });
}
 
Example 12
Source File: DrawingPanel.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * DrawingPanel constructor.
 */
public DrawingPanel() {
  glassPanel.setLayout(glassPanelLayout);
  super.setLayout(new BorderLayout());
  glassPanel.add(trMessageBox, OSPLayout.TOP_RIGHT_CORNER);
  glassPanel.add(tlMessageBox, OSPLayout.TOP_LEFT_CORNER);
  glassPanel.add(brMessageBox, OSPLayout.BOTTOM_RIGHT_CORNER);
  glassPanel.add(blMessageBox, OSPLayout.BOTTOM_LEFT_CORNER);
  glassPanel.setOpaque(false);
  super.add(glassPanel, BorderLayout.CENTER);
  setBackground(bgColor);
  setPreferredSize(new Dimension(300, 300));
  showCoordinates = true; // show coordinates by default
  addMouseListener(mouseController);
  addMouseMotionListener(mouseController);
  addOptionController();
  // invalidate the buffered image if the size changes
  addComponentListener(new java.awt.event.ComponentAdapter() {
    public void componentResized(ComponentEvent e) {
      invalidateImage(); // validImage = false;
    }

  });
  buildPopupmenu();
  refreshTimer.setRepeats(false);
  refreshTimer.setCoalesce(true);
  setFontLevel(FontSizer.getLevel());
  zoomTimer = new javax.swing.Timer(zoomDelay, new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      // reset and hide the zoom box
      zoomBox.xlast = zoomBox.xstop = zoomBox.xstart = 0;
      zoomBox.ylast = zoomBox.ystop = zoomBox.ystart = 0;
      zoomBox.visible = zoomBox.dragged = false;
      int steps = 4;
      if(zoomCount<steps) {
        zoomCount++;
        double xmin = getXMin()+dxmin/steps;
        double xmax = getXMax()+dxmax/steps;
        double ymin = getYMin()+dymin/steps;
        double ymax = getYMax()+dymax/steps;
        setPreferredMinMax(xmin, xmax, ymin, ymax);
        repaint(); // repaint the panel with the new scale
      } else {
        zoomTimer.stop();
        invalidateImage();
        repaint();
      }
    }

  });
  zoomTimer.setInitialDelay(0);
  // create guiChangeListener to change font size and refresh GUI
  // added by D Brown 29 mar 2016
  guiChangeListener = new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
    	if (e.getPropertyName().equals("level")) { //$NON-NLS-1$
       int level = ((Integer) e.getNewValue()).intValue();
       setFontLevel(level);
    	}
    	else if (e.getPropertyName().equals("locale")) { //$NON-NLS-1$
        // set the default decimal separator
    		Locale locale = (Locale)e.getNewValue();
    		if (locale.equals(OSPRuntime.PORTUGUESE)) {
    			locale = Locale.FRENCH; // substitute french since portuguese locale returns spurious decimal separator
    		}
    		DecimalFormat format = (DecimalFormat)NumberFormat.getNumberInstance(locale);
        OSPRuntime.setDefaultDecimalSeparator(format.getDecimalFormatSymbols().getDecimalSeparator());
    		refreshDecimalSeparators();
    		refreshGUI();
    	}
    }
  };
  FontSizer.addPropertyChangeListener("level", guiChangeListener); //$NON-NLS-1$
  ToolsRes.addPropertyChangeListener("locale", guiChangeListener); //$NON-NLS-1$
}