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

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

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

JFrame.dispatchEvent介绍

暂无

代码示例

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

JFrame frame= new JFrame()
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// frame stuffs here ...

frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));

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

JFrame frame= new JFrame()
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 // frame code here ..
 frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));

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

public void actionPerformed (final ActionEvent e) {
 app_.frame_.dispatchEvent(
  new WindowEvent(app_.frame_, WindowEvent.WINDOW_CLOSING)
 );
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Description of the Method
 * 
 * @param event Description of Parameter
 */
public void dispatchEvent(AWTEvent event) {
 if (frame != null) {
  frame.dispatchEvent(event);
 } else if (dialog != null) {
  dialog.dispatchEvent(event);
 }
}

代码示例来源:origin: org.antlr/antlr4

@Override
  public void actionPerformed(ActionEvent e) {
    dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
  }
}

代码示例来源:origin: brackeen/Scared

@Override
  public void run() {
    thisFrame.dispatchEvent(new WindowEvent(thisFrame, WindowEvent.WINDOW_CLOSING));
  }
});

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@Override
  public void actionPerformed(ActionEvent e) {
    dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
  }
}

代码示例来源:origin: triplea-game/triplea

public static void quitGame() {
  mainFrame.dispatchEvent(new WindowEvent(mainFrame, WindowEvent.WINDOW_CLOSING));
 }
}

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

@Rule
public ExpectedSystemExit exit = ExpectedSystemExit.none();

static JFrame frame;

@BeforeClass
public static void before() {
  frame = new JFrame();
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
}

@Test
public void test() {
  exit.expectSystemExitWithStatus(0);
  frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
}

代码示例来源:origin: com.io7m.jcamera/com.io7m.jcamera.examples.jogl

private static JMenuBar menu(
 final JFrame window)
{
 final JMenuItem quit = new JMenuItem("Quit");
 quit.addActionListener(e -> {
  final WindowEvent ev =
   new WindowEvent(window, WindowEvent.WINDOW_CLOSING);
  window.dispatchEvent(ev);
 });
 final JMenu file = new JMenu("File");
 file.add(quit);
 final JMenuBar bar = new JMenuBar();
 bar.add(file);
 return bar;
}

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

JFrame frame = new JFrame("Welcome!");
 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 ...
 JXLoginPane.JXLoginDialog dialog = new JXLoginPane.JXLoginDialog(frame, loginPane);
 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
 dialog.setVisible(true);
 if (dialog.getStatus() != JXLoginPane.Status.SUCCEEDED) {
   frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
 } else {
   // make frame visible here
 }

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

class MakeGUI {
  JFrame smallframe;
  JButton close = new JButton("CLOSE ME");

  MakeGUI() {
    frame f1 = new frame();
    smallframe = new JFrame(); //want to close this one
    JPanel jp = new JPanel(new FlowLayout());
    smallframe.setSize(300, 300);
    smallframe.setLocationRelativeTo(null);
    smallframe.setDefaultCloseOperation(smallframe.DISPOSE_ON_CLOSE);
    close.addActionListener(new action());
    jp.add(close);
    smallframe.add(jp);
    smallframe.setVisible(true);
  }

  class action implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == close) {
        // use this instead of dispose
        smallframe.dispatchEvent(new WindowEvent(smallframe, WindowEvent.WINDOW_CLOSING));
        System.out.println("gotcha");
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Sets the Closed attribute of the SkinWindowWindow object
 * 
 * @param b The new Closed value
 */
public void setClosed(boolean b) {
 if (frame != null)
  frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
 else if (dialog != null)
   dialog.dispatchEvent(new WindowEvent(dialog,
     WindowEvent.WINDOW_CLOSING));
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

public void actionPerformed(ActionEvent event) {
    JFrame frame = XBayaMenuItem.this.engine.getGUI().getFrame();
    frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING)); 
  }
});

代码示例来源:origin: net.imagej/ij

void close() {
  pFrame.dispatchEvent(new WindowEvent(pFrame,WindowEvent.WINDOW_CLOSING));
  pcp.unsetPanelShowingProperty(getRootPath().toString());
}

代码示例来源:origin: imagej/ImageJA

void close() {
  pFrame.dispatchEvent(new WindowEvent(pFrame,WindowEvent.WINDOW_CLOSING));
  pcp.unsetPanelShowingProperty(getRootPath().toString());
}

相关文章

JFrame类方法