com.alee.laf.rootpane.WebDialog Java Examples

The following examples show how to use com.alee.laf.rootpane.WebDialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TabbedEffectDialog.java    From Spade with GNU General Public License v3.0 6 votes vote down vote up
public TabbedEffectDialog(int panes, String title, ImageIcon icon)
{
	dialog = new WebDialog(Spade.main.gui.frame, title);
	if(icon != null)
		dialog.setIconImage(icon.getImage());
	dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	dialog.setAlwaysOnTop(true);
	dialog.setAutoRequestFocus(true);
	dialog.setShowResizeCorner(false);
	
	panels = new WebPanel[panes];
	JPanel panel = (JPanel) dialog.getContentPane();
	panel.setLayout(new BorderLayout());
	
	tabs = new WebTabbedPane();
	tabs.setTabStretchType(TabStretchType.always);
	panel.add(tabs, BorderLayout.CENTER);
	
	for(int i = 0; i < panes; i++)
	{
		tabs.add(panels[i] = new WebPanel());
	}
	
	bottom = new WebPanel();
	panel.add(bottom, BorderLayout.SOUTH);
}
 
Example #2
Source File: GridEffectDialog.java    From Spade with GNU General Public License v3.0 5 votes vote down vote up
public GridEffectDialog(int cols, int rows, String title, ImageIcon icon)
{
	this.dialog = new WebDialog(Spade.main.gui.frame, title);
	if(icon != null)
		dialog.setIconImage(icon.getImage());
	dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	dialog.setAlwaysOnTop(true);
	dialog.setAutoRequestFocus(true);
	dialog.setShowResizeCorner(false);
	
	panels = new JPanel[rows * cols];
	
	JPanel pane = (JPanel) dialog.getContentPane();
	
	WebPanel panel = new WebPanel();
	panel.setLayout(new GridLayout(rows, cols));
	
	for(int i = 0; i < cols * rows; i++)
	{
		panel.add(panels[i] = new WebPanel());
	}
	
	bottom = new WebPanel();
	
	pane.add(panel, BorderLayout.CENTER);
	pane.add(bottom, BorderLayout.SOUTH);
}
 
Example #3
Source File: Menu.java    From Spade with GNU General Public License v3.0 5 votes vote down vote up
public static void showOpenMenu()
{
	final WebFileChooser chooser = new WebFileChooser(Spade.getDir());
	chooser.setFileSelectionMode(WebFileChooser.FILES_ONLY);
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileFilter(new ReadableFileFilter());
	
	// Add ALL the custom image-importers!
	ImageImporter.addAllImporters(chooser);
	
	int returned = chooser.showOpenDialog(new WebDialog(Spade.main.gui.frame, "Load Image"));
	
	if(returned == WebFileChooser.APPROVE_OPTION)
	{
		// If a Image takes too long, the application might crash.
		// By running the actual loading process in another thread, the AWT-Event Thread can continue working while the image is being loaded.
		new Thread(new Runnable()
		{
			@Override
			public void run()
			{
				Document doc = Document.loadFromFile(chooser.getSelectedFile());
				if(doc != null)
				{
					Spade.addDocument(doc);
					Spade.setDocument(doc);
				}
			}
		}).start();
	}
}
 
Example #4
Source File: View.java    From desktopclient-java with GNU General Public License v3.0 4 votes vote down vote up
void showImportWizard(boolean connect) {
    WebDialog importFrame = new ImportDialog(this, connect);
    importFrame.setVisible(true);
}
 
Example #5
Source File: Notifier.java    From desktopclient-java with GNU General Public License v3.0 4 votes vote down vote up
private void showNotification() {
    final WebDialog dialog = new WebDialog();
    dialog.setUndecorated(true);
    dialog.setBackground(Color.BLACK);
    dialog.setBackground(StyleConstants.transparent);

    WebNotificationPopup popup = new WebNotificationPopup(PopupStyle.dark);
    popup.setIcon(Utils.getIcon("kontalk_small.png"));
    popup.setMargin(View.MARGIN_DEFAULT);
    popup.setDisplayTime(6000);
    popup.addNotificationListener(new NotificationListener() {
        @Override
        public void optionSelected(NotificationOption option) {
        }
        @Override
        public void accepted() {
        }
        @Override
        public void closed() {
            dialog.dispose();
        }
    });

    // content
    WebPanel panel = new WebPanel();
    panel.setMargin(View.MARGIN_DEFAULT);
    panel.setOpaque(false);
    WebLabel title = new WebLabel("A new Message!");
    title.setFontSize(View.FONT_SIZE_BIG);
    title.setForeground(Color.WHITE);
    panel.add(title, BorderLayout.NORTH);
    String text = "this is some message, and some longer text was added";
    WebLabel message = new WebLabel(text);
    message.setForeground(Color.WHITE);
    panel.add(message, BorderLayout.CENTER);
    popup.setContent(panel);

    //popup.packPopup();
    dialog.setSize(popup.getPreferredSize());

    // set position on screen
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    Rectangle screenBounds = gc.getBounds();
    // get height of the task bar
    // doesn't work on all environments
    //Insets toolHeight = toolkit.getScreenInsets(popup.getGraphicsConfiguration());
    int toolHeight  = 40;
    dialog.setLocation(screenBounds.width - dialog.getWidth() - 10,
            screenBounds.height - toolHeight - dialog.getHeight());

    dialog.setVisible(true);
    NotificationManager.showNotification(dialog, popup);
}
 
Example #6
Source File: Popup.java    From Spade with GNU General Public License v3.0 4 votes vote down vote up
public static void showException(String title, Exception e, String msg2)
{
	WebDialog dialog = new WebDialog(Spade.main.gui.frame, title);
	dialog.setModal(true);
	
	WebTextArea text = new WebTextArea();
	text.setEditable(false);
	text.setWrapStyleWord(true);
	text.setLineWrap(true);
	text.setFontName(Font.MONOSPACED);
	
	StringWriter msg = new StringWriter();
	e.printStackTrace(new PrintWriter(msg));
	text.append(msg.toString());
	
	JPanel panel = (JPanel) dialog.getContentPane();
	panel.setLayout(new BorderLayout());
	
	panel.setPreferredSize(new Dimension(800, 400));
	
	WebScrollPane scroll = new WebScrollPane(text);
	
	panel.add(new WebLabel("An Exception Occured: ").setMargin(5), BorderLayout.NORTH);
	panel.add(scroll, BorderLayout.CENTER);
	
	WebPanel bottom = new WebPanel();
	bottom.setLayout(new BorderLayout());
	
	WebTextArea report =
			new WebTextArea("Please copy the above message and report it to " + Spade.REPO_URL
					+ " along with details of what you were doing when it happened.");
	report.setLineWrap(true);
	report.setWrapStyleWord(true);
	report.setEditable(false);
	report.setMargin(5);
	
	WebTextArea endMsg = new WebTextArea(msg2);
	endMsg.setLineWrap(true);
	endMsg.setWrapStyleWord(true);
	endMsg.setEditable(false);
	endMsg.setMargin(5);
	
	bottom.add(report, BorderLayout.NORTH);
	bottom.add(endMsg, BorderLayout.CENTER);
	
	panel.add(bottom, BorderLayout.SOUTH);
	
	dialog.pack();
	dialog.setResizable(true);
	dialog.setVisible(true);
	dialog.setLocationRelativeTo(Spade.main.gui.frame);
}
 
Example #7
Source File: DialogWrapper.java    From Spade with GNU General Public License v3.0 4 votes vote down vote up
public DialogWrapper(String title)
{
	this.dialog = new WebDialog(Spade.main.gui.frame, title);
}
 
Example #8
Source File: DialogWrapper.java    From Spade with GNU General Public License v3.0 4 votes vote down vote up
public void centre()
{
	((WebDialog) dialog).center(Spade.main.gui.frame);
}
 
Example #9
Source File: LayerManager.java    From Spade with GNU General Public License v3.0 4 votes vote down vote up
public WebDialog getDialog()
{
	return dialog;
}