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

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

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

JFrame.setName介绍

暂无

代码示例

代码示例来源:origin: RS485/LogisticsPipes

public void setTitle(String title) {
    frame.setName(title);
  }
}

代码示例来源:origin: robotframework/SwingLibrary

@SuppressWarnings("serial")
private void createFrame() {
  frame = new JFrame("Test App") {
    @Override
    public Dimension getPreferredSize() {
      return new Dimension(1000, 1000);
    }
  };
  frame.setName("Main Frame");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

代码示例来源:origin: robo-code/robocode

public void run() {
    writeAttack();
    JFrame frame;
    frame = new JFrame();
    frame.setName("Hack");
    frame.setVisible(true);
  }
};

代码示例来源:origin: robo-code/robocode

public void run() {
    writeAttack();
    JFrame frame;
    frame = new JFrame();
    frame.setName("Hack");
    frame.setVisible(true);
  }
};

代码示例来源:origin: joel-costigliola/assertj-swing

@Override
 protected JFrame executeInEDT() throws Throwable {
  JFrame frame = new JFrame("Created by FEST");
  frame.setName(CREATED_FRAME_NAME);
  frame.setContentPane(contentPane);
  return frame;
 }
});

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

JFrame trollFrame = new JFrame("He he");
trollFrame.setName("RaiseJira");

代码示例来源:origin: sdedit/sdedit

public static JFrame show(JComponent comp) {
  final JFrame frame = new JFrame();
  frame.addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosing(WindowEvent e) {
      System.exit(0);
    }
  });
  frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  frame.setSize(800, 600);
  frame.setName(comp.getName());
  frame.getContentPane().add(new JScrollPane(comp));
  frame.setVisible(true);
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      UIUtilities.centerWindow(frame);
    }
  });
  return frame;
}

代码示例来源:origin: com.quinsoft.zeidon/object-browser

@Override
    public void actionPerformed( ActionEvent e )
    {
      FrameBrowserEnvironment newEnv = new FrameBrowserEnvironment( env.getOe(), null );
      final JFrame mainFrame = new JFrame();
      mainFrame.setTitle( "Zeidon Object Browser" );
      mainFrame.setName( "Object Browser" );
      mainFrame.getContentPane().add( new MainPanel( newEnv ) );

//            BrowserEventHandler listener = new BrowserEventHandler();
//            mainFrame.addWindowStateListener( listener );
//            mainFrame.addWindowListener( listener );
      mainFrame.pack();

      env.restoreEnvironment( mainFrame.getContentPane() );

      // Display the window.
      mainFrame.setVisible( true );

      // Use invokeLater otherwise toFront() won't always work.
      java.awt.EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
          mainFrame.toFront();
        }
      });
    }
  }

代码示例来源:origin: com.quinsoft.zeidon/object-browser

protected void startup()
{
  // Create and set up the window.
  mainFrame = new JFrame();
  mainFrame.setTitle( "Zeidon Object Browser" );
  mainFrame.setName( "Object Browser" );
  mainFrame.getContentPane().add( new MainPanel( env ) );
  
  URL iconUrl = Resources.getResource( "tzobrwad.png" );
  ImageIcon image = new ImageIcon( iconUrl );
  mainFrame.setIconImage( image.getImage() );
  BrowserEventHandler listener = new BrowserEventHandler();
  mainFrame.addWindowStateListener( listener );
  mainFrame.addWindowListener( listener );
  mainFrame.pack();
  env.restoreEnvironment();
  // Display the window.
  mainFrame.setVisible( true );
  
  // Use invokeLater otherwise toFront() won't always work.
  java.awt.EventQueue.invokeLater(new Runnable() {
    @Override
    public void run() {
      mainFrame.toFront();
    }
  });
}

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

jf.setName( "MyClass" );
final MyClass item = new MyClass( jf);
jf.add( item);

代码示例来源:origin: net.java.dev.appframework/appframework

/**
 * Return the JFrame used to show this View
 * 
 * <p>
 * This method may be called at any time; the JFrame is created lazily
 * and cached.  For example:
 * <pre>
 *  &#064;Override protected void startup() {
 *     getFrame().setJMenuBar(createMenuBar());
 *     show(createMainPanel());
 * }
 * </pre>
 * 
 * @return this application's  main frame
 */
public JFrame getFrame() {
if (frame == null) {
  String title = getContext().getResourceMap().getString("Application.title");
  frame = new JFrame(title);
  frame.setName("mainFrame");
}
return frame;
}

代码示例来源:origin: Audiveris/audiveris

frame.setName("scoreTreeFrame");

代码示例来源:origin: Audiveris/audiveris

/**
 * Display the UI frame.
 */
public static void showFrame ()
{
  if (frame == null) {
    frame = new JFrame();
    frame.setName("shapeColorChooserFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.add(new ShapeColorChooser().component);
    // Resources injection
    ResourceMap resource = Application.getInstance().getContext().getResourceMap(
        ShapeColorChooser.class);
    resource.injectComponents(frame);
  }
  OmrGui.getApplication().show(frame);
}

代码示例来源:origin: net.java.dev.designgridlayout/designgridlayout

@Override public void go(boolean exitOnClose)
{
  _frame = new JFrame(name());
  _frame.setName(getClass().getSimpleName());
  _frame.setDefaultCloseOperation(exitOnClose
    ? JFrame.EXIT_ON_CLOSE
    : WindowConstants.DISPOSE_ON_CLOSE);
  JPanel contentPane = new JPanel();
  contentPane.setName("TOP");
  _frame.setContentPane(contentPane);
  ComponentizerLayout layout = new ComponentizerLayout(contentPane);
  layout.withSmartVerticalResize();
  build(layout);
  _frame.pack();
  _frame.setLocationRelativeTo(null);
  _frame.setVisible(true);
}

代码示例来源:origin: org.jdesktop.bsaf/bsaf

/**
 * Return the JFrame used to show this View
 * 
 * <p>
 * This method may be called at any time; the JFrame is created lazily
 * and cached.  For example:
 * <pre>
 *  &#064;Override protected void startup() {
 *     getFrame().setJMenuBar(createMenuBar());
 *     show(createMainPanel());
 * }
 * </pre>
 * 
 * @return this application's  main frame
 */
public JFrame getFrame() {
  if (frame == null) {
    ResourceMap resourceMap = getContext().getResourceMap();
    String title = resourceMap.getString(KEY_APPLICATION_TITLE);
    frame = new JFrame(title);
    frame.setName(MAIN_FRAME_NAME);
    if (resourceMap.containsKey(KEY_APPLICATION_ICON)) {
      Image icon = resourceMap.getImageIcon(KEY_APPLICATION_ICON).getImage();
      frame.setIconImage(icon);
    }
  }
  return frame;
}

代码示例来源:origin: net.java.dev.designgridlayout/designgridlayout

@Override public void go(boolean exitOnClose)
{
  _frame = new JFrame(name());
  _frame.setName(getClass().getSimpleName());
  _frame.setDefaultCloseOperation(exitOnClose
    ? JFrame.EXIT_ON_CLOSE
    : WindowConstants.DISPOSE_ON_CLOSE);
  JPanel top = new JPanel();
  DesignGridLayout layout = new DesignGridLayout(top);
  top.setName("TOP");
  init(layout);
  build(layout);
  addTopPanel(top);
  prePack();
  _frame.pack();
  _frame.setLocationRelativeTo(null);
  _frame.setVisible(true);
}

代码示例来源:origin: net.java.dev.designgridlayout/designgridlayout

@Override public void go(boolean exitOnClose)
  _frame.setName(getClass().getSimpleName());

代码示例来源:origin: Audiveris/audiveris

/**
 * Report the selection dialog to be displayed to the user
 *
 * @return the dialog frame
 */
public static JFrame getComponent ()
{
  final JFrame frame = new JFrame();
  frame.setName("topicsFrame");
  frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  JComponent framePane = (JComponent) frame.getContentPane();
  Panel panel = new Panel();
  FormLayout layout = new FormLayout("pref", "pref, 1dlu, pref, 1dlu, pref");
  PanelBuilder builder = new PanelBuilder(layout, panel);
  CellConstraints cst = new CellConstraints();
  int r = 1;
  builder.add(new EarlyPane(), cst.xy(1, r));
  r += 2;
  builder.add(new PluginPane(), cst.xy(1, r));
  r += 2;
  builder.add(new AllTopicsPane(), cst.xy(1, r));
  framePane.add(panel);
  // Resources injection
  ResourceMap resource = Application.getInstance().getContext().getResourceMap(
      AdvancedTopics.class);
  resource.injectComponents(frame);
  return frame;
}

代码示例来源:origin: net.java.dev.designgridlayout/designgridlayout

public void go(boolean exitOnClose)
  _frame.setName(getClass().getSimpleName());
  _frame.setBounds(30, 30, 800, 600);
  _frame.setDefaultCloseOperation(exitOnClose

代码示例来源:origin: Audiveris/audiveris

frame.setName("TrainerFrame"); // For SAF life cycle

相关文章

JFrame类方法