本文整理汇总了Java中javax.swing.WindowConstants类的典型用法代码示例。如果您正苦于以下问题:Java WindowConstants类的具体用法?Java WindowConstants怎么用?Java WindowConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WindowConstants类属于javax.swing包,在下文中一共展示了WindowConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGraphEditorWindow
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* init the graph editor window
*/
private void initGraphEditorWindow()
{
// create the window
GraphEditorWindow editor = new GraphEditorWindow();
whiskasPanel.setEditor(editor);
graphEditorFrame= new JFrame("Whiskas Gradient Editor");
graphEditorFrame.getContentPane().add(editor);
graphEditorFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
graphEditorFrame.pack();
graphEditorFrame.setSize(600, 300);
graphEditorFrame.setLocation(this.getX(), this.getY()+this.getHeight());
graphEditorFrame.setVisible(true);
// try {
// InputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream("org/newdawn/slick/tools/peditor/data/icon.gif");
//
// //graphEditorFrame.setIconImage(ImageIO.read(in));
// } catch (IOException e) {
// e.printStackTrace();
// }
}
示例2: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* This method initialises this
*/
private void initialize() {
this.setSize(new Dimension(420, 46));
this.setUndecorated(true);
this.setTitle("Set Jade-LocalPort ...");
this.setModal(true);
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.setResizable(false);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
canceled = true;
setVisible(false);
}
});
this.setContentPane(getJContentPane());
// --- ESCAPE abfangen --------------------------------------
this.getRootPane().registerKeyboardAction(this, "KeyESCAPE", keyStrokeESCAPE, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
this.getRootPane().registerKeyboardAction(this, "KeyENTER", keyStrokeENTER,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
// --- Position des Dialogs einstellen ----------------------
this.setLocation(currPosition.x, currPosition.y-11);
}
示例3: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* Initialize.
*/
private void initialize() {
this.setSize(506, 185);
this.setContentPane(getJContentPane());
this.setTitle(Application.getGlobalInfo().getApplicationTitle() + ": SciMark 2.0 - Benchmark");
this.setIconImage(imageAgentGUI);
this.setLookAndFeel();
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.getContentPane().setPreferredSize(this.getSize());
this.setLocationRelativeTo(null);
// --- Translations ----
jLabelBenchmark.setText(Language.translate("Bitte warten! Der Benchmark wird durchgeführt ..."));
jLabelBenchmarkOldCaption.setText(Language.translate("Alter Wert: "));
jButtonSkip.setText(Language.translate("Überspringen"));
jButtonSkipAlways.setText(Language.translate("Immer überspringen"));
}
示例4: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* This method initializes this
* @return void
*/
private void initialize() {
this.setAutoscrolls(true);
this.setMaximizable(true);
this.setResizable(true);
this.setIconifiable(true);
this.setClosable(true);
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.setTitle("Component");
// --- Remove Frame menu ----------------
BasicInternalFrameUI ui = (BasicInternalFrameUI)this.getUI();
ui.getNorthPane().remove(0);
this.addInternalFrameListener(new InternalFrameAdapter() {
@Override
public void internalFrameClosing(InternalFrameEvent ife) {
doClose();
}
});
this.configureForGraphObject();
this.setContentPane(this.getJContentPane());
this.setSize(this.defaultWidth, this.defaultHeight);
this.setInitialSizeAndPosition();
// --- Call to the super-class ----------
this.registerAtDesktopAndSetVisible();
}
示例5: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* This method initialises this.
*/
private void initialize() {
this.setSize(620, 120);
this.setIconImage(GlobalInfo.getInternalImage("AgentGUI.png"));
this.setTitle(Application.getGlobalInfo().getApplicationTitle() + ": " + Language.translate("Load Monitor"));
this.setLookAndFeel();
this.setContentPane(this.getSystemLoadPanel());
// --- Add a WindowsListener --------------------------------
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
setVisible(false);
}
});
}
示例6: printTexture
import javax.swing.WindowConstants; //导入依赖的package包/类
private static void printTexture() {
f = new JFrame("Texture Printing Test");
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
final TexturePaintPrintingTest gpt = new TexturePaintPrintingTest();
Container c = f.getContentPane();
c.add(BorderLayout.CENTER, gpt);
final JButton print = new JButton("Print");
print.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(gpt);
final boolean doPrint = job.printDialog();
if (doPrint) {
try {
job.print();
} catch (PrinterException ex) {
throw new RuntimeException(ex);
}
}
}
});
c.add(print, BorderLayout.SOUTH);
f.pack();
f.setVisible(true);
}
示例7: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* This method initializes this.
*/
private void initialize() {
this.setSize(720, 500);
this.setTitle("Auswahl - Agenten");
this.setIconImage(GlobalInfo.getInternalImage("AgentGUI.png"));
this.setModal(true);
this.setContentPane(getJContentPane());
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
canceled = true;
setVisible(false);
}
});
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int top = (screenSize.height - this.getHeight()) / 2;
int left = (screenSize.width - this.getWidth()) / 2;
this.setLocation(left, top);
// --- Translate -----------------------------
this.setTitle(Language.translate("Auswahl - Agenten"));
jLabelSearchCaption.setText(Language.translate("Suche"));
jButtonOk.setText(Language.translate("Hinzufügen"));
jButtonCancel.setText(Language.translate("Abbrechen"));
}
示例8: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* Initialize
*/
private void initialize() {
this.setSize(542, 194);
this.setContentPane(getJContentPane());
if (this.appName!=null) {
this.setTitle(this.appName + ": Zip-Monitor");
} else {
this.setTitle("Zip-Monitor");
}
this.setIconImage(this.iconImage);
this.setLookAndFeel();
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.getContentPane().setPreferredSize(this.getSize());
this.setLocationRelativeTo(null);
this.setAlwaysOnTop(true);
// --- Translate ----
this.getJButtonCancel().setText(Language.translate("Abbruch"));
}
示例9: initialize
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* This method initializes this dialog.
*/
private void initialize() {
this.setSize(730, 606);
this.setContentPane(this.getClassSelectionPanel());
this.setTitle("Class-Selector");
this.setModal(true);
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.registerEscapeKeyStroke();
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
setCanceled(true);
setVisible(false);
}
});
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int top = (screenSize.height - this.getHeight()) / 2;
int left = (screenSize.width - this.getWidth()) / 2;
this.setLocation(left, top);
// --- Add this dialog as a listener to the ClassSelectorPanel --------
// this.classSelectionPanel.addClassSelectionListener(this);
}
示例10: createUI
import javax.swing.WindowConstants; //导入依赖的package包/类
private static void createUI(String lookAndFeelString) {
internalFrame = new JInternalFrame("Internal", true, true, true, true);
internalFrame.setDefaultCloseOperation(
WindowConstants.DO_NOTHING_ON_CLOSE);
internalFrame.setSize(200, 200);
JDesktopPane desktopPane = new JDesktopPane();
desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
desktopPane.add(internalFrame);
mainFrame = new JFrame(lookAndFeelString);
mainFrame.setSize(640, 480);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setContentPane(desktopPane);
mainFrame.setVisible(true);
internalFrame.setVisible(true);
}
示例11: showFrame
import javax.swing.WindowConstants; //导入依赖的package包/类
private static void showFrame(Drawing model, String title) {
JFrame frame = new JFrame(title);
DrawingAttributeSet attrs = new DrawingAttributeSet();
Canvas canvas = new Canvas();
Toolbar toolbar = new Toolbar(canvas, attrs);
canvas.setModel(model, new UndoLogDispatcher(new UndoLog()));
canvas.setTool(toolbar.getDefaultTool());
AttrTable table = new AttrTable(frame);
AttrTableDrawManager manager = new AttrTableDrawManager(canvas, table, attrs);
manager.attributesSelected();
HorizontalSplitPane west = new HorizontalSplitPane(toolbar, table, 0.5);
VerticalSplitPane all = new VerticalSplitPane(west, canvas, 0.3);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().add(all, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
示例12: initWindow
import javax.swing.WindowConstants; //导入依赖的package包/类
/**
* Initialize parameters of the window (size, title)... Then calls <code>initComponents</code>
* @param target target application (JMODEL or JSIM)
*/
protected void initWindow(int target) {
this.target = target;
// Sets default title, close operation and dimensions
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Editing Default Parameters...");
int width = 840, height = 600;
// Centers this dialog on the screen
Dimension scrDim = Toolkit.getDefaultToolkit().getScreenSize();
setBounds((scrDim.width - width) / 2, (scrDim.height - height) / 2, width, height);
// If user closes this window, act as cancel and reloads saved parameters
addWindowStateListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Defaults.reload();
}
});
initComponents(target);
}
示例13: MainFrame
import javax.swing.WindowConstants; //导入依赖的package包/类
private MainFrame() {
this.setSize(800, 600);
this.setTitle("Tomcat ������������� - powered by how2j.cn");
this.setContentPane(MainPanel.instance);
this.setLocationRelativeTo(null);
this.setResizable(false);
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(MainFrame.instance, "Ҫ�˳���"))
System.exit(1);
else
MainFrame.this.setState(JFrame.ICONIFIED);
}
});
}
示例14: setupUI
import javax.swing.WindowConstants; //导入依赖的package包/类
private void setupUI() {
frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
comboBox = new JComboBox<>(ITEMS);
JPanel scrollable = new JPanel();
scrollable.setLayout(new BoxLayout(scrollable, BoxLayout.Y_AXIS));
scrollable.add(Box.createVerticalStrut(200));
scrollable.add(comboBox);
scrollable.add(Box.createVerticalStrut(200));
scrollPane = new JScrollPane(scrollable);
frame.add(scrollPane);
frame.setSize(100, 200);
frame.setVisible(true);
}
示例15: main
import javax.swing.WindowConstants; //导入依赖的package包/类
public static void main(String [] args)
{
JFrame v_Frame = new JFrame();
JButton v_Button = new JButton("设置时间");
JDateTime v_DateTime = new JDateTime();
v_DateTime.addActionListener(new JDateTimeActionListener(v_DateTime));
v_Button.addActionListener(new ButtonActionListener(v_DateTime ,v_Button));
v_Frame.getContentPane().setLayout(new BorderLayout());
v_Frame.getContentPane().add(v_Button ,BorderLayout.NORTH);
v_Frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
v_Frame.setSize(800, 600);
v_Frame.setVisible(true);
}