javax.swing.JFrame.getToolkit()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中javax.swing.JFrame.getToolkit()方法的一些代码示例,展示了JFrame.getToolkit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getToolkit()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getToolkit

JFrame.getToolkit介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

if (bytes != null) {
  JFrame f = new JFrame();
  image = f.getToolkit().createImage(bytes);

代码示例来源:origin: Talend/tesb-rt-se

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
private static void createAndShowGUI(CarSearchModel searchModel, CarReserveModel reserveModel) {
  //Create and set up the window.
  JFrame appFrame = new JFrame(Messages.CarRentalClient_Title);
  appFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  // Display the window centered on the screen
  Dimension d = appFrame.getToolkit().getScreenSize();
  appFrame.setLocation((d.width / 2) - (appFrame.getWidth() / 2), (appFrame.getHeight() / 2));
  CarRentalClientGui gui = new CarRentalClientGui(searchModel, reserveModel);
  gui.appFrame = appFrame;
  appFrame.setContentPane(gui);        
  appFrame.pack();
  appFrame.setVisible(true);
  appFrame.toFront();
}

代码示例来源:origin: stackoverflow.com

public static void moveToCenterScreen(JFrame frame) {
  Toolkit kit = frame.getToolkit();       
  GraphicsDevice[] gs = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
  Insets in = kit.getScreenInsets(gs[0].getDefaultConfiguration());
  Dimension d = kit.getScreenSize();

  int max_width = (d.width - in.left - in.right);
  int max_height = (d.height - in.top - in.bottom);   

  frame.setLocation((int) (max_width - frame.getWidth()) / 2, (int) (max_height - frame.getHeight() ) / 2);
}

代码示例来源:origin: Waikato/weka-trunk

public static void main(String[] args) {
 weka.core.logging.Logger.log(weka.core.logging.Logger.Level.INFO,
  "Logging started");
 LookAndFeel.setLookAndFeel();
 PackageManager pm = new PackageManager();
 if (!WekaPackageManager.m_noPackageMetaDataAvailable) {
  String offline = "";
  if (WekaPackageManager.m_offline) {
   offline = " (offline)";
  }
  final javax.swing.JFrame jf =
   new javax.swing.JFrame("Weka Package Manager" + offline);
  jf.getContentPane().setLayout(new BorderLayout());
  jf.getContentPane().add(pm, BorderLayout.CENTER);
  jf.addWindowListener(new java.awt.event.WindowAdapter() {
   @Override
   public void windowClosing(java.awt.event.WindowEvent e) {
    jf.dispose();
    System.exit(0);
   }
  });
  Dimension screenSize = jf.getToolkit().getScreenSize();
  int width = screenSize.width * 8 / 10;
  int height = screenSize.height * 8 / 10;
  jf.setBounds(width / 8, height / 8, width, height);
  jf.setVisible(true);
  pm.setInitialSplitPaneDividerLocation();
 }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

public static void main(String[] args) {
 weka.core.logging.Logger.log(weka.core.logging.Logger.Level.INFO,
  "Logging started");
 LookAndFeel.setLookAndFeel();
 PackageManager pm = new PackageManager();
 if (!WekaPackageManager.m_noPackageMetaDataAvailable) {
  String offline = "";
  if (WekaPackageManager.m_offline) {
   offline = " (offline)";
  }
  final javax.swing.JFrame jf =
   new javax.swing.JFrame("Weka Package Manager" + offline);
  jf.getContentPane().setLayout(new BorderLayout());
  jf.getContentPane().add(pm, BorderLayout.CENTER);
  jf.addWindowListener(new java.awt.event.WindowAdapter() {
   @Override
   public void windowClosing(java.awt.event.WindowEvent e) {
    jf.dispose();
    System.exit(0);
   }
  });
  Dimension screenSize = jf.getToolkit().getScreenSize();
  int width = screenSize.width * 8 / 10;
  int height = screenSize.height * 8 / 10;
  jf.setBounds(width / 8, height / 8, width, height);
  jf.setVisible(true);
  pm.setInitialSplitPaneDividerLocation();
 }
}

代码示例来源:origin: mguessan/davmail

mainFrame.setLocation(mainFrame.getToolkit().getScreenSize().width / 2 -
    mainFrame.getSize().width / 2,
    mainFrame.getToolkit().getScreenSize().height / 2 -
        mainFrame.getSize().height / 2);
mainFrame.setVisible(true);

代码示例来源:origin: apache/felix

Dimension maxdim = m_frame.getToolkit().getScreenSize();
int m_width=maxdim.width-100;
int m_height=maxdim.height-100;

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

Dimension e = f.getToolkit().getScreenSize();

代码示例来源:origin: MegaMek/megamek

frame.setForeground(SystemColor.menuText);
List<Image> iconList = new ArrayList<Image>();
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16).toString()
));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32).toString()
));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48).toString()
));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256).toString()
));

代码示例来源:origin: MegaMek/megamek

/**
 * Get the single title image in a threadsafe way.
 * 
 * @param frame - a <code>JFrame</code> object to instantiate the image.
 * @return the title <code>Image</code> common to all "about" dialogs.
 *         This value should <b>not</b> be <code>null</code>.
 */
private static synchronized Image getTitleImage(JFrame frame) {
  // Have we loaded our image yet?
  if (imgTitleImage == null) {
    // Nope. Load it.
    Image image = frame.getToolkit().getImage(
        new MegaMekFile(Configuration.miscImagesDir(), FILENAME_MEGAMEK_SPLASH2).toString()
    );
    MediaTracker tracker = new MediaTracker(frame);
    tracker.addImage(image, 0);
    try {
      tracker.waitForID(0);
      imgTitleImage = image;
    } catch (InterruptedException exp) {
      exp.printStackTrace();
    }
  } // End load-imgTitleImage
  // Return our image.
  return imgTitleImage;
}

代码示例来源:origin: MegaMek/megamek

iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16)
        .toString()));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32)
        .toString()));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48)
        .toString()));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256)
        .toString()));

代码示例来源:origin: MegaMek/megamek

frame.setForeground(SystemColor.menuText);
List<Image> iconList = new ArrayList<Image>();
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16)
        .toString()));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32)
        .toString()));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48)
        .toString()));
iconList.add(frame.getToolkit().getImage(
    new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256)
        .toString()));

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

view.getFrame().getToolkit().beep();
return false;
  view.getFrame().getToolkit().beep();
  return false;

代码示例来源:origin: MegaMek/megamek

Image imgSplash = frame.getToolkit()
    .getImage(new MegaMekFile(Configuration.widgetsDir(), splashFilename).toString());

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

view.getFrame().getToolkit().beep();
return false;
    view.getFrame().getToolkit().beep();
      view.getFrame().getToolkit().beep();

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

final JComponent cwin = (JComponent) win.getContentPane();
final JFrame app = (JFrame) getApp();
final Dimension de = app.getToolkit().getScreenSize();

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

view.getFrame().getToolkit().beep();

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

view.getFrame().getToolkit().beep();
return false;

相关文章

JFrame类方法