本文整理汇总了Java中javax.swing.JDialog.add方法的典型用法代码示例。如果您正苦于以下问题:Java JDialog.add方法的具体用法?Java JDialog.add怎么用?Java JDialog.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JDialog
的用法示例。
在下文中一共展示了JDialog.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import javax.swing.JDialog; //导入方法依赖的package包/类
public void run() {
Random thisR = new Random();
JLabel lbl = new JLabel(this.detail);
if(numSpawners < 100) {
this.child = new DialogSpawner(this.title, this.detail);
this.child.run();
}
while(true) {
JDialog d = new JDialog(new JFrame());
d.setSize(500, 200);
d.setTitle(this.title);
d.add(lbl);
d.setLocation(thisR.nextInt(500)+200, thisR.nextInt(500)+200);
d.show();
}
}
示例2: SpecialDiceButton
import javax.swing.JDialog; //导入方法依赖的package包/类
public SpecialDiceButton() {
dialog = new JDialog(GameModule.getGameModule().getFrame());
dialog.setLayout(new MigLayout("ins 0"));
dialogLabel = new JLabel();
dialogLabel.setIcon(resultsIcon);
dialog.add(dialogLabel);
final ActionListener rollAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
DR();
}
};
launch = new LaunchButton(null, TOOLTIP, BUTTON_TEXT, HOTKEY, ICON, rollAction);
final String desc = Resources.getString("Editor.SpecialDiceButton.symbols"); //$NON-NLS-1$
setAttribute(NAME, desc);
setAttribute(BUTTON_TEXT, desc);
launch.setAttribute(TOOLTIP, desc);
}
示例3: doTest
import javax.swing.JDialog; //导入方法依赖的package包/类
private static void doTest(Runnable action) {
String description
= " A print dialog will be shown.\n "
+ " Please select Pages within Page-range.\n"
+ " and enter From 2 and To 3. Then Select OK.";
final JDialog dialog = new JDialog();
dialog.setTitle("JobAttribute Updation Test");
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Start Test");
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
action.run();
});
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
}
示例4: main
import javax.swing.JDialog; //导入方法依赖的package包/类
public static void main( String[] args) {
JDialog loadingDialog = new JDialog();
JPanel textPanel = new JPanel(new BorderLayout());
JLabel textLabel = new JLabel("wArra");
textLabel.setText("Wslsls");
textLabel.setToolTipText("dlkas");
textPanel.add(textLabel);
loadingDialog.add(textPanel);
loadingDialog.pack();
loadingDialog.setSize(300,100);
loadingDialog.setVisible(true);
}
示例5: createROCPlotDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
/** Creates a dialog containing a plotter for a given list of ROC data points. */
public void createROCPlotDialog(ROCData data) {
ROCChartPlotter plotter = new ROCChartPlotter();
plotter.addROCData("ROC", data);
JDialog dialog = new JDialog();
dialog.setTitle("ROC Plot");
dialog.add(plotter);
dialog.setSize(500, 500);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
}
示例6: buttonColorActionPerformed
import javax.swing.JDialog; //导入方法依赖的package包/类
private void buttonColorActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonColorActionPerformed
final JDialog di = new JDialog(this, true);
di.setTitle(getLocaleMessage("dialog.select_color"));
final JColorChooser cc = new JColorChooser(
Color.decode("#" + textFieldFontColor.getText()));
di.setSize(450, 440);
LayoutManager l = new FlowLayout(2, 10, 10);
di.setLayout(l);
di.add(cc);
final JButton but = new JButton(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
textFieldFontColor
.setText(
Integer.toHexString(cc.getColor().getRGB()).substring(2).toUpperCase());
runningLabel.setForeground(Color.decode("#" + textFieldFontColor.getText()));
di.setVisible(false);
}
});
but.setText(getLocaleMessage("dialog.select"));
but.setSize(20, 20);
di.add(but);
Uses.setLocation(di);
di.setVisible(true);
}
示例7: main
import javax.swing.JDialog; //导入方法依赖的package包/类
public static void main(String[] args) {
final String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
final JDialog d = new JDialog();
d.setTitle("Flow Label Test");
d.setModal(true);
d.setResizable(true);
d.setLocationRelativeTo(null);
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.add(new FlowLabel(loremIpsum + "\n\n" + loremIpsum));
d.pack();
d.setVisible(true);
}
示例8: addTo
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* Expects to be added to a GameModule. Adds a JButton to the control window's toolbar. Pushing the button displays
* the window
*/
public void addTo(Buildable b) {
rebuild();
launch.setAlignmentY(0.0F);
GameModule.getGameModule().getToolBar().add(launch);
frame = new JDialog(GameModule.getGameModule().getFrame());
GameModule.getGameModule().addKeyStrokeSource(new KeyStrokeSource(frame.getRootPane(), JComponent.WHEN_IN_FOCUSED_WINDOW));
while (root.getComponentCount() > 0) {
frame.add(root.getComponent(0));
}
root = frame.getContentPane();
frame.setTitle(launch.getAttributeValueString(DEPRECATED_NAME));
int count = GameModule.getGameModule().getComponentsOf(ChartWindow.class).size();
id = "ChartWindow" + count; //$NON-NLS-1$
}
示例9: addTo
import javax.swing.JDialog; //导入方法依赖的package包/类
public void addTo(Buildable b) {
// Support for players changing sides
PlayerRoster.addSideChangeListener(this);
launch.setAlignmentY(0.0F);
GameModule.getGameModule().getToolBar().add(getComponent());
GameModule.getGameModule().getGameState().addGameComponent(this);
frame = new JDialog(GameModule.getGameModule().getFrame());
frame.setTitle(getConfigureName());
String key = "Inventory." + getConfigureName(); //$NON-NLS-1$
GameModule.getGameModule().getPrefs().addOption(new PositionOption(key, frame));
frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
frame.add(initTree());
frame.add(initButtons());
frame.setSize(250, 350);
}
示例10: createDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
public static JDialog createDialog(Frame owner, String title, String gradientTitle) {
JDialog dialog = new JDialog(owner, title, true);
dialog.setLayout(new BorderLayout());
dialog.add(Guitilities.createGradientTitle(title), BorderLayout.NORTH);
dialog.setLocationRelativeTo(owner);
dialog.setLocationByPlatform(true);
dialog.setResizable(false);
return dialog;
}
示例11: initializeChooseColumnDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
private void initializeChooseColumnDialog( String input ) {
String tempURLString = null;
if ( hole.getLeg() < 100 ) {
tempURLString = DSDP.DSDP_PATH + input + "/" + hole.toString() + "-" + input + ".txt";
}
else {
tempURLString = DSDP.DSDP_PATH + "ODP_" + input + "/" + hole.toString() + "-" + input + ".txt";
}
try {
DensityBRGTable tempTable = new DensityBRGTable(tempURLString);
selectSedimentDialog = new JDialog(dsdpF);
selectSedimentDialog.setTitle("Select Column");
selectSedimentDialog.addWindowListener(this);
selectAddColumnCB = new JComboBox();
selectAddColumnCB.addItem("Select Column");
for ( int i = 1; i < tempTable.headings.length; i++ ) {
selectAddColumnCB.addItem(tempTable.headings[i]);
}
selectAddColumnCB.addItemListener(this);
selectSedimentDialog.add(selectAddColumnCB);
selectSedimentDialog.pack();
selectSedimentDialog.setSize( 195, 100 );
selectSedimentDialog.setLocation( selectSedimentDialogX, selectSedimentDialogY );
selectSedimentDialog.setVisible(true);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
示例12: createAndShowTestDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
private static void createAndShowTestDialog(String description,
String failMessage, Runnable action) {
final JDialog dialog = new JDialog();
dialog.setTitle("Test: " + (++testCount));
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Print Table");
final JButton passButton = new JButton("PASS");
passButton.setEnabled(false);
passButton.addActionListener((e) -> {
dialog.dispose();
});
final JButton failButton = new JButton("FAIL");
failButton.setEnabled(false);
failButton.addActionListener((e) -> {
throw new RuntimeException(failMessage);
});
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
action.run();
passButton.setEnabled(true);
failButton.setEnabled(true);
});
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
buttonPanel.add(passButton);
buttonPanel.add(failButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
}
示例13: mapaLabelMouseClicked
import javax.swing.JDialog; //导入方法依赖的package包/类
private void mapaLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mapaLabelMouseClicked
JDialog dialog = new JDialog();
dialog.setUndecorated(true);
JLabel label = new JLabel(imagemIcone);
dialog.setLocationRelativeTo(this);
dialog.setUndecorated(false);
dialog.add(label);
dialog.pack();
dialog.setVisible(true);
}
示例14: testMemLeakPluginManagerUI
import javax.swing.JDialog; //导入方法依赖的package包/类
public void testMemLeakPluginManagerUI () throws Exception {
help = this;
close = new JButton ();
SwingUtilities.invokeAndWait (new Runnable () {
public void run () {
ui = new PluginManagerUI (close);
}
});
assertNotNull (ui);
ref = new WeakReference<PluginManagerUI> (ui);
assertNotNull (ref.get ());
dlg = new JDialog (new JFrame ());
dlg.setBounds (100, 100, 800, 500);
dlg.add (ui);
SwingUtilities.invokeAndWait (new Runnable () {
public void run () {
dlg.setVisible (true);
}
});
ui.initTask.waitFinished ();
Thread.sleep (1000);
SwingUtilities.invokeAndWait (new Runnable () {
public void run () {
dlg.setVisible (false);
dlg.getContentPane ().removeAll ();
dlg.dispose ();
}
});
Thread.sleep (10500);
//dlg = null;
close = null;
ui = null;
assertNull (ui);
ToolTipManager.sharedInstance ().mousePressed (null);
// sun.management.ManagementFactoryHelper.getDiagnosticMXBean().dumpHeap("/tmp/heapdump2.out", true);
assertGC ("Reference to PluginManagerUI is empty.", ref);
assertNotNull (ref);
assertNull (ref.get ());
}
示例15: doTest
import javax.swing.JDialog; //导入方法依赖的package包/类
private static void doTest(Runnable action) {
String description
= " Visual inspection of print dialog is required.\n"
+ " A print dialog will be shown.\n "
+ " Please verify Copies 5 is selected.\n"
+ " Also verify, Page Range is selected with "
+ " from page 3 and to Page 4.\n"
+ " If ok, press PASS else press FAIL";
final JDialog dialog = new JDialog();
dialog.setTitle("printSelectionTest");
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Start Test");
final JButton passButton = new JButton("PASS");
passButton.setEnabled(false);
passButton.addActionListener((e) -> {
dialog.dispose();
pass();
});
final JButton failButton = new JButton("FAIL");
failButton.setEnabled(false);
failButton.addActionListener((e) -> {
dialog.dispose();
fail();
});
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
action.run();
passButton.setEnabled(true);
failButton.setEnabled(true);
});
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
buttonPanel.add(passButton);
buttonPanel.add(failButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
}