jdialog

Java: How can I bring a JFrame to the front?

半腔热情 提交于 2019-12-18 09:02:55
问题 I am currently waiting for a very important announcement and I have created a simple application to check every 30 minutes whether the announcement was made or not When the announcement is made, I want a window to pop up and inform me about it. The window is just a simple JFrame that has some text in it. I have a class called Announcement. Inside this class I define another class for the frame called Form, so I have something like this: class Form{ public Form(){ //create frame and show it

java黑客帝国数字雨特效源码

。_饼干妹妹 提交于 2019-12-18 00:56:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.image.MemoryImageSource; import java.util.Random; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.Timer; public class Rain extends JDialog implements ActionListener { private Random random = new Random(); private Dimension screenSize; private JPanel graphicsPanel; //行高,列宽 private final static int gap = 20; //存放雨点顶部的位置信息(marginTop) private int[] posArr; //行数

Show JDialog on Windows taskbar

主宰稳场 提交于 2019-12-17 18:46:07
问题 I'm trying to display a JDialog in Windows. How do I show a JDialog (like JFrame ) on my Windows taskbar? 回答1: A dialog itself cannot have a task bar entry, but you can construct a frame that does not have any visible effect and use it as a parent for the dialog. Then it will look like the dialog has a task bar entry. The following code shows you how to do it: class MyDialog extends JDialog { private static final List<Image> ICONS = Arrays.asList( new ImageIcon("icon_16.png").getImage(), new

How do I make my SwingWorker example work properly?

梦想的初衷 提交于 2019-12-17 02:38:09
问题 I've made my own SwingWorker example to get familiar with how it works. What I'm wanting to do is the following: When the button is clicked I want a progress bar appear until the task is done I want to simply remove the progress bar and add a string to the dialog. When the button is clicked, the progress bar comes up but never goes away. (never removes the progress bar after 10 seconds and never places the label up) Here is an SSCCE: package swingtesting; import java.awt.event.ActionEvent;

How do I make my SwingWorker example work properly?

送分小仙女□ 提交于 2019-12-17 02:38:07
问题 I've made my own SwingWorker example to get familiar with how it works. What I'm wanting to do is the following: When the button is clicked I want a progress bar appear until the task is done I want to simply remove the progress bar and add a string to the dialog. When the button is clicked, the progress bar comes up but never goes away. (never removes the progress bar after 10 seconds and never places the label up) Here is an SSCCE: package swingtesting; import java.awt.event.ActionEvent;

Why wont this KeyEvent work?

萝らか妹 提交于 2019-12-13 06:19:22
问题 I am making something in java that when the F1 key is hit a JDialog window to apear.My current code: public class Keyboard implements KeyListener { private boolean[] keys = new boolean[120]; public boolean up, down, left, right, assets; public void tick() { assets = keys[KeyEvent.VK_F1]; } public void keyPressed(KeyEvent e) { keys[e.getKeyCode()] = true; } public void keyReleased(KeyEvent e) { keys[e.getKeyCode()] = false; } public void keyTyped(KeyEvent e) { } } And in my main class under

How to handle oversized JDialog

岁酱吖の 提交于 2019-12-13 03:52:59
问题 I'm developing a JDialog which will have three sections, one on the top of the other: customer general information, list of customer addresses and list of orders. The list of customer addresses may grow arbitrarily large and this causes the dialog to grow beyond the screen height. Thus, calling pack() before displaying it does not work because the packed dialog height is still too big for the screen height. This calls for a scroll pane. But I would have to set the dialog's preferred size to

Java Open URL Inside of a JFrame

大城市里の小女人 提交于 2019-12-13 03:33:30
问题 I was wondering if there is a way to open a URL inside of a JFrame or JDialog. I need this to protect the URL. Is there a way to run a browser inside of a Java component such as a JFrame or a JDialog? 回答1: This should be what you are looking for, a web browser component that you can easily use in your SWING application 回答2: This would only make the URL secret for dummies. With a network sniffer like Ethereal, it would be trivial to know which requests are made by your application. Security

Associate predefined action to close button Java JDialog

与世无争的帅哥 提交于 2019-12-13 02:38:55
问题 I have an action defined in the same package as the JDialog. I want to bind the Java Dialog`s close button to this action, without using window listeners. Just set once this action to the button. Can you help me do this, please? Thank you 回答1: The following code should achieve what you need using a WindowAdapter as a WindowListener. The windowClosing method is called exactly once upon pressing the close button. If you plan to add an alternative Close-Button you can always fire a windowClosing

How to get the size of JPanel which is not visible yet

◇◆丶佛笑我妖孽 提交于 2019-12-13 00:32:18
问题 I have a resizable JScrollPane inside a JDialog. That JScrollPane has a JPanel(called container) All these JScrollPane,JPanel and Jdialog are resizable. At the run time, another JPanel(called child) is added to the previous jPanel which is inside the JScrollPane of the JDialog.I want to get the size of the 'child' JPanel size. Before and after adding the 'child' JPanel to the 'container' JPanel, sizes of 'child' and 'container' JPanels are shown as 0 0. ( child.getSize() , container.getSize()