当前位置: 首页>>代码示例>>Java>>正文


Java JDialog类代码示例

本文整理汇总了Java中javax.swing.JDialog的典型用法代码示例。如果您正苦于以下问题:Java JDialog类的具体用法?Java JDialog怎么用?Java JDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JDialog类属于javax.swing包,在下文中一共展示了JDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDialog

import javax.swing.JDialog; //导入依赖的package包/类
/**
 * Gets the authorization dialog.
 *
 * @param presetUsername username which should be shown preset when displaying the dialog
 * @param owner the window to which the dialog should belong (to center etc.)
 * @return the dialog
 */
public JDialog getDialog(String presetUsername, Window owner) {

	authDialog = new JDialog(owner);
	OIDCPanel oidcPanel = new OIDCPanel(this);
	if (presetUsername != null) {
		oidcPanel.getJTextFieldUsername().setText(presetUsername);
	}
	authDialog.setContentPane(oidcPanel);
	authDialog.setSize(new Dimension(500, 190));
	authDialog.setLocationRelativeTo(null);
	return authDialog;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:OIDCAuthorization.java

示例2: show

import javax.swing.JDialog; //导入依赖的package包/类
/** Helper method for constructing an always-on-top modal dialog. */
private static Object show(String title, int type, Object message, Object[] options, Object initialOption) {
	if (options == null) {
		options = new Object[] {
				"Ok"
		};
		initialOption = "Ok";
	}
	JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption);
	p.setInitialValue(initialOption);
	JDialog d = p.createDialog(null, title);
	p.selectInitialValue();
	d.setAlwaysOnTop(true);
	d.setVisible(true);
	d.dispose();
	return p.getValue();
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:18,代码来源:OurDialog.java

示例3: initDialog

import javax.swing.JDialog; //导入依赖的package包/类
void initDialog() {
	dialog = new JDialog( 
//	dialog = new JFrame(
		(JFrame)grid.getTopLevelAncestor(), 
		"Grid Rendering Tools");
	tabs = new JTabbedPane(JTabbedPane.TOP);
	tabs.add( "Rendering", this);
	dialog.getContentPane().add(tabs);
	JLabel label = new JLabel("Rendering tools are new "
			+"and still under development - "
			+"use with caution");
	dialog.getContentPane().add(label, "South");
	dialog.pack();
	tabs.add( "3D", pers);
	tabs.addChangeListener( new ChangeListener() {
		public void stateChanged(ChangeEvent e) {
			tabChange();
		}
	});
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:21,代码来源:RenderTools.java

示例4: create

import javax.swing.JDialog; //导入依赖的package包/类
@Override
public JDialog create(Consumer<JPanel> consumer) {
    try {
        window.setIconImage(new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/VISNode_64.png"))).getImage());
    } catch (IOException ex) {
        ExceptionHandler.get().handle(ex);
    }
    JPanel container = new JPanel(new BorderLayout());
    container.setBorder(new CompoundBorder(new EmptyBorder(3, 3, 3, 3), new CompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(6, 6, 6, 6))));
    consumer.accept(container);
    window.getContentPane().setLayout(new BorderLayout());
    window.getContentPane().add(container);
    window.pack();
    window.setLocationRelativeTo(null);
    return window;
}
 
开发者ID:VISNode,项目名称:VISNode,代码行数:17,代码来源:WindowFactory.java

示例5: showUpgradeDialog

import javax.swing.JDialog; //导入依赖的package包/类
private static boolean showUpgradeDialog (final File source, String note) {
       Util.setDefaultLookAndFeel();

JPanel panel = new JPanel(new BorderLayout());
panel.add(new AutoUpgradePanel (source.getAbsolutePath (), note), BorderLayout.CENTER);
JProgressBar progressBar = new JProgressBar(0, 100);
progressBar.setValue(0);
progressBar.setStringPainted(true);
progressBar.setIndeterminate(true);
panel.add(progressBar, BorderLayout.SOUTH);
progressBar.setVisible(false);

JButton bYES = new JButton("Yes");
bYES.setMnemonic(KeyEvent.VK_Y);
JButton bNO = new JButton("No");
bNO.setMnemonic(KeyEvent.VK_N);
JButton[] options = new JButton[] {bYES, bNO};
       JOptionPane p = new JOptionPane (panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, options, bYES);
       JDialog d = Util.createJOptionProgressDialog(p, NbBundle.getMessage (AutoUpgrade.class, "MSG_Confirmation_Title"), source, progressBar);
       d.setVisible (true);

       return new Integer (JOptionPane.YES_OPTION).equals (p.getValue ());
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AutoUpgrade.java

示例6: createDialog

import javax.swing.JDialog; //导入依赖的package包/类
/**
 * Creates and returns a fresh dialog for the given frame.
 */
private JDialog createDialog(Component frame) {
    Object[] buttons = new Object[] {getOkButton(), getCancelButton()};
    // input panel with text area and choice box
    JPanel input = new JPanel();
    input.setLayout(new BorderLayout());
    input.setPreferredSize(new Dimension(300, 150));
    input.add(new JLabel("<html><b>Enter value:"), BorderLayout.NORTH);
    input.add(new JScrollPane(getTextArea()), BorderLayout.CENTER);
    input.add(getChoiceBox(), BorderLayout.SOUTH);
    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());
    main.add(input, BorderLayout.CENTER);
    if (this.parsed) {
        JPanel errorPanel = new JPanel(new BorderLayout());
        errorPanel.add(getErrorLabel());
        main.add(errorPanel, BorderLayout.SOUTH);
        main.add(createSyntaxPanel(), BorderLayout.EAST);
    }
    JOptionPane panel = new JOptionPane(main, JOptionPane.PLAIN_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION, null, buttons);
    JDialog result = panel.createDialog(frame, this.title);
    result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    result.addWindowListener(this.closeListener);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:29,代码来源:StringDialog.java

示例7: CopyFiles

import javax.swing.JDialog; //导入依赖的package包/类
private CopyFiles(File source, File target, File patternsFile) {
    this.sourceRoot = source;
    this.targetRoot = target;
    try {
        InputStream is = new FileInputStream(patternsFile);
        Reader reader = new InputStreamReader(is, "utf-8"); // NOI18N
        readPatterns(reader);
        reader.close();
    } catch (IOException ex) {
        // set these to null to stop further copying (see copyDeep method)
        sourceRoot = null;
        targetRoot = null;
        LOGGER.log(Level.WARNING, "Import settings will not proceed: {0}", ex.getMessage());
        // show error message and continue
        JDialog dialog = Util.createJOptionDialog(new JOptionPane(ex, JOptionPane.ERROR_MESSAGE), "Import settings will not proceed");
        dialog.setVisible(true);
        return;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CopyFiles.java

示例8: actionPerformed

import javax.swing.JDialog; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
    if (!isEnabled())
        return;

    TermOptions clonedTermOptions = termOptions.makeCopy();
    TermOptionsPanel subPanel = new TermOptionsPanel();
    subPanel.setTermOptions(clonedTermOptions);

    JOptionPane optionPane = new JOptionPane(subPanel,
                                             JOptionPane.PLAIN_MESSAGE,
                                             JOptionPane.OK_CANCEL_OPTION
                                             );
        JDialog dialog = optionPane.createDialog(Terminal.this,
                                                 "NBTerm Options");
        dialog.setVisible(true);      // WILL BLOCK!

        if (optionPane.getValue() == null)
            return;     // was closed at the window level

        switch ((Integer) optionPane.getValue()) {
            case JOptionPane.OK_OPTION:
                System.out.printf("Dialog returned OK\n");
                termOptions.assign(clonedTermOptions);
                applyTermOptions(false);
                termOptions.storeTo(prefs);
                break;
            case JOptionPane.CANCEL_OPTION:
                System.out.printf("Dialog returned CANCEL\n");
                break;
            case JOptionPane.CLOSED_OPTION:
                System.out.printf("Dialog returned CLOSED\n");
                break;
            default:
                System.out.printf("Dialog returned OTHER: %s\n",
                                  optionPane.getValue());
                break;
        }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:Terminal.java

示例9: createAndShowGUI

import javax.swing.JDialog; //导入依赖的package包/类
public static void createAndShowGUI() {
    frame = new JFrame("JFrame");
    frame.setSize(WIDTH, HEIGHT);
    frame.setLocation(100, 300);

    dialog = new JDialog(frame, false);
    dialog.setSize(250, 250);
    dialog.setUndecorated(true);
    dialog.setLocation(400, 300);
    dlgPos = dialog.getLocation();
    backgroundDialog = new JDialog(frame, false);
    backgroundDialog.setSize(250, 250);
    backgroundDialog.getContentPane().setBackground(Color.red);
    backgroundDialog.setLocation(dlgPos.x, dlgPos.y);

    frame.setVisible(true);
    backgroundDialog.setVisible(true);
    dialog.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TransparencyTest.java

示例10: actionPerformed

import javax.swing.JDialog; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae) {
    
	if (ae.getSource()==this.button) {
        //The user has clicked the cell, so bring up the dialog.
        button.setBackground(currentColor);
       
        //Set up the dialog that the button brings up.
        colorChooser = new JColorChooser();
        colorChooser.setColor(currentColor);
        JDialog dialog = JColorChooser.createDialog(button, "Pick a Color", true, colorChooser, this,  null); 
        dialog.setVisible(true);
        // --- From here: user action in the dialog ---
        fireEditingStopped();
        
    } else { //User pressed dialog's "OK" button.
        currentColor = colorChooser.getColor();
    }
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:TableCellEditor4Color.java

示例11: showDialog

import javax.swing.JDialog; //导入依赖的package包/类
public static Color showDialog(Component component, String title,
        Color initial) {
    JColorChooser choose = new JColorChooser(initial);

    JDialog dialog = createDialog(component, title, true, choose, null, null);

    AbstractColorChooserPanel[] panels = choose.getChooserPanels();
    for (AbstractColorChooserPanel accp : panels) {
        choose.removeChooserPanel(accp);
    }
    GrayScaleSwatchChooserPanel grayScaleSwatchChooserPanelFreeStyle = new GrayScaleSwatchChooserPanel();
    GrayScalePanel grayScalePanelFreeStyle = new GrayScalePanel();
    choose.addChooserPanel(grayScaleSwatchChooserPanelFreeStyle);
    choose.addChooserPanel(grayScalePanelFreeStyle);

    dialog.getContentPane().add(choose);
    dialog.pack();
    dialog.setVisible(true);//.show();

    return choose.getColor();
}
 
开发者ID:MohamadSaada,项目名称:LogiGSK,代码行数:22,代码来源:JColorChooserGrayScale.java

示例12: handleAbout

import javax.swing.JDialog; //导入依赖的package包/类
void handleAbout() {
    //#221571 - check if About window is showing already
    Window[] windows = Dialog.getWindows();
    if( null != windows ) {
        for( Window w : windows ) {
            if( w instanceof JDialog ) {
                JDialog dlg = (JDialog) w;
                if( Boolean.TRUE.equals(dlg.getRootPane().getClientProperty("nb.about.dialog") ) ) { //NOI18N
                    if( dlg.isVisible() ) {
                        dlg.toFront();
                        return;
                    }
                }
            }
        }
    }
    performAction("Help", "org.netbeans.core.actions.AboutAction"); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:NbApplicationAdapter.java

示例13: showProgress

import javax.swing.JDialog; //导入依赖的package包/类
public static ProgressDialog showProgress(Component parent, String message)
{
	JDialog d = ComponentHelper.createJDialog(parent);
	ProgressDialog p = new ProgressDialog(d);

	d.getRootPane().setWindowDecorationStyle(JRootPane.INFORMATION_DIALOG);
	d.setResizable(false);
	d.setContentPane(p);
	d.setTitle(message);
	d.pack();

	d.setLocationRelativeTo(parent);
	d.setVisible(true);

	return p;
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:ProgressDialog.java

示例14: jButton1ActionPerformed

import javax.swing.JDialog; //导入依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    
    try {
        //JOptionPane pane = new JOptionPane();
        //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
        JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false);
        JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n");
        msg.setFont(new Font("monospaced", Font.PLAIN, 10));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        
        dialog.getContentPane().add(scrollPane);
        dialog.setSize(350, 350);
        //dialog.pack();
        dialog.setVisible(true);
        
        
    } catch (JSONException ex) {
        Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:ffleurey,项目名称:ThingML-Tradfri,代码行数:23,代码来源:BulbPanel.java

示例15: showmsg

import javax.swing.JDialog; //导入依赖的package包/类
/** Popup the given informative message, then ask the user to click Close to close it. */
public static void showmsg(String title, Object... msg) {
   JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close");
   Object[] objs = new Object[msg.length + 1];
   System.arraycopy(msg, 0, objs, 0, msg.length);
   objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null);
   JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{});
   JDialog dialog = about.createDialog(null, title);
   dismiss.addActionListener(Runner.createDispose(dialog));
   dialog.setAlwaysOnTop(true);
   dialog.setVisible(true);
   dialog.dispose();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:OurDialog.java


注:本文中的javax.swing.JDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。