Tabnine Logo
ComponentUtil.centerComponentInWindow
Code IndexAdd Tabnine to your IDE (free)

How to use
centerComponentInWindow
method
in
org.apache.jorphan.gui.ComponentUtil

Best Java code snippets using org.apache.jorphan.gui.ComponentUtil.centerComponentInWindow (Showing top 7 results out of 315)

origin: org.apache.jmeter/jorphan

/**
 * Use this static method if you want to center and set its position
 * compared to the size of the current users screen size. Valid percent is
 * between +-(0-100) minus is treated as plus, bigger than 100 is always set
 * to 100.
 *
 * @param component
 *            the component you want to center and set size on
 * @param percentOfScreen
 *            the percent of the current screensize you want the component
 *            to be
 */
public static void centerComponentInWindow(Component component, int percentOfScreen) {
  if (percentOfScreen < 0) {
    centerComponentInWindow(component, -percentOfScreen);
    return;
  }
  if (percentOfScreen > 100) {
    centerComponentInWindow(component, 100);
    return;
  }
  double percent = percentOfScreen / 100.d;
  Rectangle bounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds();
  component.setSize((int) (bounds.getWidth() * percent), (int) (bounds.getHeight() * percent));
  centerComponentInWindow(component);
}
origin: org.apache.jmeter/ApacheJMeter_core

/**
 * @return {@link JDialog} Help window and initializes it if necessary
 */
private static JDialog initHelpWindow() {
  if (helpWindow == null) {
    helpWindow = new EscapeDialog(new Frame(),// independent frame to
                        // allow it to be overlaid
                        // by the main frame
        JMeterUtils.getResString("help"),//$NON-NLS-1$
        false);
    helpWindow.getContentPane().setLayout(new GridLayout(1, 1));
    helpWindow.getContentPane().removeAll();
    helpWindow.getContentPane().add(scroller);
    ComponentUtil.centerComponentInWindow(helpWindow, 60);
  }
  return helpWindow;
}
origin: org.apache.jmeter/ApacheJMeter_core

ComponentUtil.centerComponentInWindow(this);
origin: org.apache.jmeter/ApacheJMeter_core

private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
  templateList.setValues(TemplateManager.getInstance().getTemplateNames());            
  templateList.addChangeListener(this);
  reloadTemplateButton.addActionListener(this);
  reloadTemplateButton.setFont(FONT_SMALL);
  this.getContentPane().setLayout(new BorderLayout(10, 0));
  
  JPanel templateBar = new JPanel(new BorderLayout());
  templateBar.add(templateList, BorderLayout.CENTER);
  JPanel reloadBtnBar = new JPanel();
  reloadBtnBar.add(reloadTemplateButton);
  templateBar.add(reloadBtnBar, BorderLayout.EAST);
  this.getContentPane().add(templateBar, BorderLayout.NORTH);
  helpDoc.setContentType("text/html"); //$NON-NLS-1$
  helpDoc.setEditable(false);
  helpDoc.addHyperlinkListener(this);
  this.getContentPane().add(scroller, BorderLayout.CENTER);
  applyTemplateButton.addActionListener(this);
  cancelButton.addActionListener(this);
  // Bottom buttons bar
  JPanel actionBtnBar = new JPanel(new FlowLayout());
  actionBtnBar.add(applyTemplateButton);
  actionBtnBar.add(cancelButton);
  this.getContentPane().add(actionBtnBar, BorderLayout.SOUTH);
  this.pack();
  this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT));
  ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size
  populateTemplatePage();
}
origin: org.apache.jmeter/ApacheJMeter_core

ComponentUtil.centerComponentInWindow(this);
origin: org.apache.jmeter/ApacheJMeter_core

ComponentUtil.centerComponentInWindow(this);
origin: org.apache.jmeter/ApacheJMeter_core

MainFrame main = new MainFrame(treeModel, treeLis);
splash.setProgress(100);
ComponentUtil.centerComponentInWindow(main, 80);
main.setLocationRelativeTo(splash);
main.setVisible(true);
org.apache.jorphan.guiComponentUtilcenterComponentInWindow

Javadoc

Use this static method if you want to center a component in Window.

Popular methods of ComponentUtil

  • centerComponentInComponent
    Use this static method if you want to center a component over another component.

Popular in Java

  • Reading from database using SQL prepared statement
  • getSharedPreferences (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now