Swing/AWT/SWT :: Have JDialog Dispose When Focus Is Lost?

Jan 21, 2014

This code will not dismiss the MemoryDateDialog when it loses focus, while it is what it is intended to do.

btnMemoryReason.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
List<MemoryDates> lMemoryDates = db.getMemoryDates(custID);
final MemoryDateDialog mdd = new MemoryDateDialog(lMemoryDates);

[URL] .....

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: How To Release / Dispose A Form

Apr 9, 2014

I have this code:

RegistraFolios dg = new RegistraFolios();
dg.dispose();
dg.setUndecorated(true);
dg.setLocationRelativeTo(null);
dg.setVisible(true);
JOptionPane.showInputDialog(dg);

in last line i show the form in modal mode.

how to free? i try this:

private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}

but not work.

View Replies View Related

Swing/AWT/SWT :: Factory Design Pattern With Swing JDialog

Jul 26, 2014

Is it a good idea to use the factory design pattern for say if I needed to create four different JDialogs for the same parent frame?

factory design interface
package client;
public interface Dialog {
void getInstanceOf ();
void initComponents ();
}

One of the four JDialog class would look something like this without the comments.

package client;
import javax.swing.JDialog;
@SuppressWarnings("serial")
public class AddCustomerDialog extends JDialog implements Dialog{
public AddCustomerDialog () {
//Some stuff goes here to set the settings for JDialog instance

[code]....

Of course you would have your factory class

View Replies View Related

Swing/AWT/SWT :: How To Return 2 Values For A JDialog

May 10, 2014

All the samples I found use JOptionPane to return a single value. I am looking to return two values from two Text fields.

View Replies View Related

Swing/AWT/SWT :: JDialog Close Operation

Mar 4, 2011

how the entire application could be close when you click on X in a JDialog Box. I have tried

System.Exit (0)

but it only close the Dialog box

View Replies View Related

Swing/AWT/SWT :: Allow JDialog To Resize Larger But Not Smaller

May 16, 2014

Lets say the JDialog opens 5x5. The user is allowed to modify its size to be any size larger than 5x5 but is not allowed to make it smaller. Is there such a property or will this have to be regulated via code?

View Replies View Related

Swing/AWT/SWT :: Program Doesn't Close Through JDialog Box

Mar 30, 2014

I have a practice exercise here wherein I will add a JOptionPane to a program. When the close button is clicked, the JOptionPane will appear asking the user to exit the program. If the user clicks "Yes," it'll, of course, close the entire program and not just the JOptionPane, but if the user clicks "No," it will return to the program. Please refer to my code below:

try
{
output = new DataOutputStream(new FileOutputStream("ProjSixExe4.dat"));
}
catch(IOException ex) {
this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING))
}
final JOptionPane optionpane = new JOptionPane("Are you sure you want to quit
this program?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

The exercise said it must be placed before the EXIT_ON_CLOSE portion.

View Replies View Related

Swing/AWT/SWT :: How To Refresh JFrame When Close JDialog

Jun 5, 2014

I have JFrame and when I click a button which is in frame JDialog is opened. Now,how can I refresh JFrame when close JDoalog?

View Replies View Related

Swing/AWT/SWT :: How To Put A JButton At Lower Right Corner Of JDialog With MigLayout

Jan 26, 2014

With the MigLayout for Swing, I'd like to see the JDialog looking like the standard windows Dialog,where to have the OK and cancel buttons at the lower right corner.

View Replies View Related

Swing/AWT/SWT :: How To Customize Focus Traversal Through Tab Key

Apr 29, 2014

I'm facing a problem in controlling the focus traversal mechanism inside a jframe...as i want the focus to travel from top to bottom by pressing tab key regularly , but it travels left to right and then top to bottom through the textfields... The form looks like
textfield1 textfield4

textfield2 textfield5

textfield3

The focus travels from 1 to 4 , 2 to 5 and then rests at 3. but i want it to be like from 1 to 2 to 3 and then 4 and 5....

View Replies View Related

Swing/AWT/SWT :: How To Change Jbutton Color While It Is In Focus

Jan 27, 2013

refer to this code~

import java.awt.GridLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.Color;
import javax.swing.JButton;

[Code] ....

View Replies View Related

Lost Session In Weblogic

Aug 20, 2014

I have two different web apps (let's name them A and B) running on Tomcat (v5). At some point, one of A's JSPs invokes one of B's through an iFrame that contains a form. Then, B does its bussiness and sends an answer to another one of A's JSPs, which now can continue doing its stuff.

As I said, this runs on Tomcat with zero problems.

But recently I tried to deploy both apps on Weblogic (v9.2) and found one big problem: just when B has sent the answer, A loses the session and has to stop.

What could be the cause to this?

View Replies View Related

Swing/AWT/SWT :: How To Use Container Order Focus Traversal Policy

Feb 1, 2014

the focus traversal policy (hereafter "tab order") in forms and panels doesn't follow the order in which controls were inserted into the container, but is derived from the position of the components on the form or panel. This is very neat (and probably allows sloppy coders and GUI builders to exist without actually ever thinking about the tab order), except when it isn't. As when you actually want to specify a different component order, for example.

In the following example, I've created a form with two columns of buttons. I want the tab order to go through the first column of buttons, followed by second column of buttons (ie. a column-by-column schema). The default tab order is row-by-row, however, and can be obtained for reference by commenting out the setupFocus() call in the constructor.

I had hoped that the ContainerOrderFocusTraversalPolicy would do the job, but there is a couple of problems (which I've addressed in the setupFocus() method). Firstly, the container itself is part of the focus chain. This at least is easily remediable by calling setFocusable(false), but I don't have to do that with the initial focus traversal policy, so I wonder why I have to do it with this one. The other problem is more pressing, though - the ContainerOrderFocusTraversalPolicy lets me (un)hapilly tab through JLabels. Again, I've fixed this, but the initial policy knows all by itself that it's not a good idea to focus a JLabel. Moreover, I'm afraid there might be other components that do not receive focus with the original policy, but ContainerOrderFocusTraversalPolicy might plod though them.

isn't there some focus traversal policy implementation that I could just set and it would tab through exactly the same components as the original policy, except it would order them according to their order in the container?

Code:

package test;
import java.awt.Component;
import java.awt.ContainerOrderFocusTraversalPolicy;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

[code]...

View Replies View Related

Swing/AWT/SWT :: Give JTextArea Focus - Using It On A Panel And With JToolBar

Apr 21, 2014

I have a program with a main panel JPanel that implements KeyListener. I added a JTextArea to which I added as the KeyListener: this, meaning the main panel. I made the JTextArea fill the entire main panel because I want to catch a key press anywhere in the main panel.I catch the key presses and the program does what I want it to.

I added a JToolBar to the program; it is working just fine.Now that I have two components on the main panel - toolbar and panel with textarea -, the textarea must have the focus before it will send the KeyEvent and call keyPressed(). I don't want to expect the user to click on the main window to get the program to start or after each time they use the toolbar.

I have tried calling both requestFocus() and requestFocusInWindow() on the textarea; neither call worked. I put the toolbar at PAGE_END instead of PAGE_START; this worked to allow the program to start but I don't want to have the toolbar at the bottom and once I clicked on a toolbar button, the textarea lost the focus.

I need to be able to give the textarea the focus when the program starts and after the user uses a toolbar button. (I suspect that if I solve the problem when the program starts, I can use the same method after handling a button press.)

View Replies View Related

Swing/AWT/SWT :: JTable - Cell Keeps Focus After Clear Selection

May 7, 2014

I'm having a small problem using a jTable.

After calling the .clearSelection() methode of the table object, the cell clicked in when selecting the table row, keeps it's focus.

How do I remove the focus of the cell?

View Replies View Related

Swing/AWT/SWT :: Providing Focus To Keyboard Buttons On JInternalFrame

Dec 5, 2014

I'm having issues with providing focus to keyboard buttons when a JInternalFrame with keyboard buttons is called in my program. So for example when the program is started the attachment called signinscn.png is called.

This screen is a JDesktopPane which calls JPanel for its components.

From here a JInternalFrame containing the buttons ESC and F1 to F4 as seen in the attachment called signinscn.png is called.

I would like the buttons in my JInternalFrame to have focus such that when a user engages the equivalent keyboard button i.e. ESC or F1 to F4 WITHOUT clicking on the JInternalFrame the respective button's action listener kicks in. At the moment only after the user clicks on the JInternalFrame do the equivalent keyboard buttons respond.

Here's the constructor of my JInternalFrame and you can see how I handle the ESC keyboard button in the constructor of the JInternalFrame (but as I mentioned only after the user has engaged the JInternalFrame):

//!<
public AdminHomeJIFrame() {
super(null, false, // Resizable
false, // Closable
false, // Maximizable
false); // Iconifiable

BasicInternalFrameTitlePane titlePane =
(BasicInternalFrameTitlePane)((BasicInternalFrameUI)this.getUI()).getNorthPane();

[Code] ....

View Replies View Related

Swing/AWT/SWT :: Set A Column In A JTable To Make It Unable To Gain Focus?

Jun 29, 2007

How would you set a column in a JTable to make it unable to gain focus i.e. select the next column on the same row or ignore the command completely when selecting a column that should not be able to be gained focus on?

View Replies View Related

Swing/AWT/SWT :: Move Focus From Specific Jcombobox To Specific Jtextarea?

Nov 5, 2014

How do I move focus from a jcombobox to a specific component say a jtextarea.

My attempt below seems to be moving to a random component not the desired jtextarea.

takenByCombo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
dayJTArea.requestFocus(); // focust not moving dayJTArea
}
}
});

I applied the above logic to move focus from a specific jtextarea to another jtextarea as seen below and it works as desired.

dayJTArea.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
monthJTArea.requestFocus();
}
}
});

View Replies View Related

How To Dispose Off Native Components

Jan 7, 2014

Currently I get errors when trying to exit my JFrame without playing the youtube video I have set it to load.

My Code:

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;

[Code] ....

If it's relevant the error:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)

[Code] .....

View Replies View Related

Possible To Dispose Internal Frame

Nov 20, 2014

Is it possible to dispose(); an internal frame and keep my main JFrame open.

View Replies View Related

Dispose Of Containers Ifs And Elses Using Polymorphism

May 31, 2014

I would eliminate the ifs and elses using polymorphisms that solves this lot of ifs? How could I solve this?

View Replies View Related

JFrame Not Responding To Dispose Function

Jun 13, 2014

I am trying to code a program which pops up a file chooser window or dialog box to select a file first, if the user clicks 'cancel' or closes the window then the parent JFrame would not show up.

Java Code:

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.UnsupportedLookAndFeelException;
public final class base extends javax.swing.JFrame {

[Code] .....

The problem is that the JFrame shows up even if I click cancel in the file chooser. I am using Netbeans.

View Replies View Related

How To Attach OpenGL Display To JFrame And Dispose Off It Properly

Nov 12, 2014

How can i attach the OpenGl display to a JFrame and so that when i close the JFrame is destroys the display? Here is my code so far:

package test.core;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.WindowAdapter;

[Code] .....

I had the opengl display attach to the JFrame before i did the runnable. But after adding the runnable the display now shows up the same size as my screen size. I have tried rearranging the

canvas.setSize();
and the
frame.setSize();

but nothing changes the opengl display is still the same size and when i try to close the JFrame first rather then close the display first i get this error:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: From thread Thread[AWT-EventQueue-0,6,main]: Thread[main,5,main] already has the context current

which points me to my

Display.destroy();

which im guessing is telling me that i am not properly disposing the display? How to attach the opengl display to the JFrame and fix the error above?

View Replies View Related

Create JDialog Showing Database?

Jan 30, 2015

We are asked to create a JDialog showing our database. I am able to show the database but i can't seem to position the heading panel, table and back button. My back button is also not showing up. Here is part of my code...

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.sql.*;
import javax.swing.*;

[Code] ....

View Replies View Related

JDialog - How To Position Two Lables Replace Each Other

Jul 14, 2014

This is my code:

JDialog dialog = new JDialog();
dialog.setSize(400, 150);
dialog.setTitle("Input dialog");
dialog.add( new JLabel("simtime(min)") );
dialog.add( new JLabel("interval(sec)") );
dialog.setVisible(true);

The problem is that the two lables replace each other.How to position them where we want?

View Replies View Related

Remove Icon On Jdialog Which Has Owner?

May 21, 2013

JFrame frame = new JFrame();
frame.setIcon("aaa.ico");
JDilaog dialog = new JDialg(frame, "dialog" , true);

so the dialog has its owner frame, which is neccessary but i want the dialog has another icon ,or remove the icon on the dialog how may i do ?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved