當前位置: 首頁>>代碼示例>>Java>>正文


Java JDialog.add方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:DrDab,項目名稱:dahak,代碼行數:17,代碼來源:DialogSpawner.java

示例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);
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:18,代碼來源:SpecialDiceButton.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:JobAttrUpdateTest.java

示例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);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:13,代碼來源:ContributedGridsOverlay.java

示例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);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:12,代碼來源:ROCDataGenerator.java

示例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);

}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:30,代碼來源:FBoardParams.java

示例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);
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:14,代碼來源:FlowLabel.java

示例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$
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:19,代碼來源:ChartWindow.java

示例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);
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:16,代碼來源:Inventory.java

示例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;
}
 
開發者ID:kristian,項目名稱:JDigitalSimulator,代碼行數:10,代碼來源:Guitilities.java

示例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();
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:30,代碼來源:DSDPDemo.java

示例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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:36,代碼來源:ImageableAreaTest.java

示例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);
}
 
開發者ID:lucas-dolsan,項目名稱:tcc-rpg,代碼行數:11,代碼來源:TelaJogo.java

示例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 ());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:47,代碼來源:PluginManagerActionTest.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:44,代碼來源:DlgAttrsBug.java


注:本文中的javax.swing.JDialog.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。