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


Java JDialog.setAlwaysOnTop方法代码示例

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


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

示例1: 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

示例2: createCancelDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Creates a modal dialog that will interrupt this thread, when the
 * cancel button is pressed.
 */
private JDialog createCancelDialog() {
    JDialog result;
    // create message dialog
    JOptionPane message = new JOptionPane(
        isAnimated() ? getAnimationPanel()
            : new Object[] {getStateCountLabel(), getTransitionCountLabel()},
        JOptionPane.PLAIN_MESSAGE);
    message.setOptions(new Object[] {getCancelButton()});
    result = message.createDialog(getFrame(), "Exploring state space");
    result.pack();
    result.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    result.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ExploreThread.this.interrupt();
        }
    });
    result.setAlwaysOnTop(true);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:25,代码来源:ExploreAction.java

示例3: getProgressMonitorContainer

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Returns the progress monitor container that is either a JDialog or a JInternFrame.
 * @return the progress monitor container
 */
private Container getProgressMonitorContainer() {
	if (progressMonitorContainer==null) {
		
		Dimension defaultSize = new Dimension(570, 188);
		if (this.parentDesktopPane==null) {
			JDialog jDialog = new JDialog(this.owner);	
			jDialog.setSize(defaultSize);
			jDialog.setResizable(false);
			if (this.owner==null) {
				jDialog.setAlwaysOnTop(true);
			}
			jDialog.setTitle(this.windowTitle);
			if (this.iconImage!=null) {
				jDialog.setIconImage(this.iconImage.getImage());	
			}
			jDialog.setContentPane(this.getJContentPane());
			jDialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
			
			this.progressMonitorContainer = jDialog; 
			this.setLookAndFeel();	
				
		} else {
			JInternalFrame jInternalFrame = new JInternalFrame();
			jInternalFrame.setSize(defaultSize);
			jInternalFrame.setResizable(false);
			
			jInternalFrame.setTitle(this.windowTitle);
			if (this.iconImage!=null) {
				jInternalFrame.setFrameIcon(this.iconImage);	
			}
			jInternalFrame.setContentPane(this.getJContentPane());
			jInternalFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
			
			this.progressMonitorContainer = jInternalFrame;
		}
		
	}
	return progressMonitorContainer;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:44,代码来源:ProgressMonitor.java

示例4: 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:AlloyTools,项目名称:org.alloytools.alloy,代码行数:18,代码来源:OurDialog.java

示例5: 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:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:OurDialog.java

示例6: 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

示例7: initSpyDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Initializes Spy dialog.
 */
protected void initSpyDialog(Component rootComponent, Component component) {
	if (rootComponent instanceof Dialog) {
		spyDialog = new CaddyDialog((Dialog) rootComponent) {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	} else if (rootComponent instanceof Frame) {
		spyDialog = new CaddyDialog((Frame) rootComponent) {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	} else {
		spyDialog = new JDialog() {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	}
	spyDialog.setName("SwingSpy");
	spyDialog.setTitle("SwingSpy");
	spyDialog.setModal(false);
	spyDialog.setAlwaysOnTop(true);
	Container contentPane = spyDialog.getContentPane();
	contentPane.setLayout(new BorderLayout());
	spyPanel = new SwingSpyPanel();
	spyPanel.reload(rootComponent, component);
	contentPane.add(spyPanel);
	spyDialog.pack();

	spyDialog.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			super.windowClosed(e);
			spyGlass.setVisible(false);
			spyDialog = null;
		}
	});
	spyDialog.setLocationRelativeTo(null);
	spyDialog.setVisible(true);
}
 
开发者ID:igr,项目名称:swingspy,代码行数:49,代码来源:SwingSpy.java

示例8: toObsidianFile

import javax.swing.JDialog; //导入方法依赖的package包/类
@Override
public ObsidianFile toObsidianFile(File file) {
	String error = "Failed to import from Tabula file: " + file.getName();
	try
	{
		String entityName = file.getName().substring(0, file.getName().indexOf("."));

		//Model
		TabulaModel tblModel = new TabulaModel(file);
		String duplicatePartName;
		if((duplicatePartName = containsDuplicateParts(tblModel)) != null) {
			error += ". The model contains the duplicate part " + duplicatePartName;
			throw new RuntimeException(error);
		}
		
		ObjModel objModel = tblConverter.tcn2obj(tblModel, 0.0625f);			
		byte[] modelBytes = createModelBytes(objModel.toStringList());
		
		//Texture
		ZipFile zipFile = new ZipFile(file);
		ZipEntry textureEntry = zipFile.getEntry(TBL_TEXTURE_NAME);
		byte[] textureBytes;
		if(textureEntry != null) 
			textureBytes = IOUtils.toByteArray(zipFile.getInputStream(textureEntry));
		else {
			File defaultTexture = new File(getClass().getClassLoader().getResource("model_textures/grey.png").getPath());
			textureBytes = IOUtils.toByteArray(new FileInputStream(defaultTexture));
		}
		zipFile.close();
		
		return new ObsidianFile(entityName, modelBytes, textureBytes);	
	}
	catch (Exception e1)
	{
	    final JOptionPane pane = new JOptionPane(error);
	    final JDialog d = pane.createDialog((JFrame)null, "Import Error");
	    d.setAlwaysOnTop(true);
	    d.setVisible(true);
		e1.printStackTrace();
		return null;
	}
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:43,代码来源:ImporterTabula.java

示例9: toObsidianFile

import javax.swing.JDialog; //导入方法依赖的package包/类
@Override
public ObsidianFile toObsidianFile(File file)
{
	String error = "Failed to import from Qubble file: " + file.getName();

	try
	{
		String entityName = file.getName().split("\\.")[0];

		//Model
		QubbleModel qubbleModel = load(file);
		String duplicatePartName;
		if((duplicatePartName = containsDuplicateParts(qubbleModel)) != null) {
			error += ". The model contains the duplicate part " + duplicatePartName;
			throw new RuntimeException(error);
		}

		ObjModel objModel = qblConverter.qbl2obj(qubbleModel, 0.0625F);

		//Texture
		ZipFile zipFile = new ZipFile(file);
		ZipEntry textureEntry = zipFile.getEntry("base.png");

		byte[] textureBytes;

		if (textureEntry != null)
		{
			textureBytes = IOUtils.toByteArray(zipFile.getInputStream(textureEntry));
		}
		else
		{
			textureBytes = IOUtils.toByteArray(new FileInputStream(defaultTexture));
		}

		zipFile.close();

		byte[] modelBytes = createModelBytes(objModel.toStringList());
		return new ObsidianFile(entityName, modelBytes, textureBytes);
	}
	catch (Exception e1)
	{
		final JOptionPane pane = new JOptionPane(error);
		final JDialog d = pane.createDialog(null, "Import Error");
		d.setAlwaysOnTop(true);
		d.setVisible(true);
		e1.printStackTrace();
		return null;
	}
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:50,代码来源:ImporterQubble.java

示例10: importServers

import javax.swing.JDialog; //导入方法依赖的package包/类
public static void importServers(GuiMultiplayer guiMultiplayer)
{
	JFileChooser fileChooser =
		new JFileChooser(WurstFolders.SERVERLISTS.toFile())
		{
			@Override
			protected JDialog createDialog(Component parent)
				throws HeadlessException
			{
				JDialog dialog = super.createDialog(parent);
				dialog.setAlwaysOnTop(true);
				return dialog;
			}
		};
	fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	fileChooser.setAcceptAllFileFilterUsed(false);
	fileChooser.addChoosableFileFilter(
		new FileNameExtensionFilter("TXT files", "txt"));
	int action = fileChooser.showOpenDialog(FrameHook.getFrame());
	if(action == JFileChooser.APPROVE_OPTION)
		try
		{
			File file = fileChooser.getSelectedFile();
			BufferedReader load = new BufferedReader(new FileReader(file));
			int i = 0;
			for(String line = ""; (line = load.readLine()) != null;)
			{
				i++;
				guiMultiplayer.savedServerList.addServerData(
					new ServerData("Grief me #" + i, line, false));
				guiMultiplayer.savedServerList.saveServerList();
				guiMultiplayer.serverListSelector.setSelectedSlotIndex(-1);
				guiMultiplayer.serverListSelector
					.updateOnlineServers(guiMultiplayer.savedServerList);
			}
			load.close();
			guiMultiplayer.refreshServerList();
		}catch(IOException e)
		{
			e.printStackTrace();
			MiscUtils.simpleError(e, fileChooser);
		}
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12-OF,代码行数:44,代码来源:ServerHook.java

示例11: createDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
private JDialog createDialog(Frame owner) {
    JDialog result = getOptionPane().createDialog(owner, "Exploration Progress");
    result.setAlwaysOnTop(true);
    getListener().setDialog(result);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:7,代码来源:ExploreWarningDialog.java

示例12: loadFile

import javax.swing.JDialog; //导入方法依赖的package包/类
public void loadFile(File f){
		try {
			int length = (int)f.length();
			JDialog d = new JDialog((Frame)null, "Loading File");
			JPanel p = new JPanel(new BorderLayout());
			p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
			d.setLocationRelativeTo(null);
			JProgressBar pb = new JProgressBar(0,length);
			p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
			p.add(pb);
			d.getContentPane().add(p);
			d.pack();
			d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			d.setVisible(true);
			d.setAlwaysOnTop(true);
			BufferedReader in = new BufferedReader(new FileReader(f));
			StringBuffer strBuff = new StringBuffer();
			String i = in.readLine();
			
//			GMA 1.4.8: Test for '\t' in first line of input to set proper delimiting
			if ( i != null && i.indexOf("\t") != -1 ) {
				delim.setSelectedItem("Tab");
			}
			else {
				delim.setSelectedItem("Comma");
			}
			
			while (i!=null) {
				pb.setValue(pb.getValue() + (2*i.length() + 36));
				pb.repaint();
				strBuff.append(i+"\n");
				i=in.readLine();
			}
			name.setText(f.getName().substring(0, f.getName().lastIndexOf('.')));
			in.close();
			d.dispose();
			input.setText(strBuff.toString());
		} catch (Exception e) {
			JOptionPane.showMessageDialog(null, "Error loading file:\n"+e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
		}

	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:43,代码来源:OtherDBInputDialog.java

示例13: loadExcelFile

import javax.swing.JDialog; //导入方法依赖的package包/类
public void loadExcelFile(File f){
	try {
		int length = (int)f.length();
		JDialog d = new JDialog((Frame)null, "Loading File");
		JPanel p = new JPanel(new BorderLayout());
		p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
		d.setLocationRelativeTo(null);
		JProgressBar pb = new JProgressBar(0,length);
		p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
		p.add(pb);
		d.getContentPane().add(p);
		d.pack();
		d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		d.setVisible(true); 
		d.setAlwaysOnTop(true);

		Workbook wb = Workbook.getWorkbook(new ProgressMonitorInputStream(this,"Loading",new FileInputStream(f)));
		if (wb.getNumberOfSheets()==0)return;
		Sheet s = wb.getSheet(0);
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < s.getRows(); i++) {
			for (int j = 0; j < s.getColumns(); j++)
			{
					if (s.getCell(j, i).getType() == CellType.NUMBER && !s.getCell(j, i).getContents().matches("\\d*"))
					{
						pb.setValue(pb.getValue()+ 16);
						pb.repaint();
						sb.append(((NumberCell)s.getCell(j, i)).getValue()+"\t");
					}
					else
					{
						pb.setValue(pb.getValue() + 2*s.getCell(j, i).getContents().length() + 36);
						pb.repaint();
						sb.append(s.getCell(j, i).getContents()+"\t");
					}
			}
			sb.append("\n");
		}
		name.setText(f.getName().substring(0, f.getName().lastIndexOf('.')));
		input.setText(sb.toString());
		wb.close();
		d.dispose();

	} catch (Exception e) {
		JOptionPane.showMessageDialog(null, "Error loading file:\n"+e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
		return;
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:49,代码来源:OtherDBInputDialog.java

示例14: loadExcelURL

import javax.swing.JDialog; //导入方法依赖的package包/类
public void loadExcelURL(String c){
	try {
		URL url = URLFactory.url(c);
		int length = url.openConnection().getContentLength();
		JDialog d = new JDialog((Frame)null, "Loading File");
		JPanel p = new JPanel(new BorderLayout());
		p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
		d.setLocationRelativeTo(null);
		JProgressBar pb = new JProgressBar(0,length);
		p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
		p.add(pb);
		d.getContentPane().add(p);
		d.pack();
		d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		d.setVisible(true); 
		d.setAlwaysOnTop(true);
		Workbook wb = Workbook.getWorkbook(url.openStream());
		if (wb.getNumberOfSheets()==0) return;
		Sheet s = wb.getSheet(0);
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < s.getRows(); i++) {
			for (int j = 0; j < s.getColumns(); j++)
			{
					if (s.getCell(j, i).getType() == CellType.NUMBER && !s.getCell(j, i).getContents().matches("\\d*")) {
						sb.append(((NumberCell)s.getCell(j, i)).getValue()+"\t");	
						pb.setValue(pb.getValue() + 16);
						pb.repaint();
					}
					else {
						pb.setValue(pb.getValue() + 2*s.getCell(j, i).getContents().length()+36);
						pb.repaint();
						sb.append(s.getCell(j, i).getContents()+"\t");
					}
					//if (j<s.getRows()-1) sb.append(s.getCell(j, i).getContents()+"\t");
				//else sb.append(s.getCell(j, i).getContents()+"\t");
			}
			sb.append("\n");
		}
		name.setText(url.getFile().substring(url.getFile().lastIndexOf('/')+1, url.getFile().lastIndexOf('.')));
		input.setText(sb.toString());
		wb.close();
		d.dispose();
	} catch (Exception e) {
		JOptionPane.showMessageDialog(null, "Error reading URL:\n"+e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
		return;
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:48,代码来源:OtherDBInputDialog.java


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