Dialog Is Not Disposed On Windows 8
May 13, 2014
i am using a frame over which i am loading a dialog. The singleton dialog holds a progress bar. I have created my own swing worker. i am controlling the construct method of swing worker(which functions like doInBackground method).I am trying to call hidedialog from an external file. The dialog gets stuck sometimes. How do i solve it . It works fine on win7 but fails on win8.
public class LoadingProgressDialogSingleton extends com.manu.scpoweb.common.ds.client.swing.dialog.Dia log {
protected static LoadingProgressDialogSingleton oneAndOnlyProgressDialog = null;
JProgressBar progressBar = null;
DFULoadStatusBean dfuLoadStatusBean = null;
[code]....
View Replies
ADVERTISEMENT
Mar 29, 2014
This is the code I have written so far. This program calculates tax from multiple tax payers.
import javax.swing.JOptionPane;
public class CalcutateTax
{
public static void main (String [] args)
[code]....
The problem is I cant think how to ask the use if he wants to calculate tax due for another taxpayer. If the user says yes, keep calculating, otherwise exit from the program. And how do I keep count of how many people got their tax calculated? Say for example,
JOptionPane.showMessageDialog (null, " We calculated tax for " + xnumber + " number of people.");
This is the question asked on my assignment ask the user if he wants to calculate the tax due for another taxpayer if so, do it again.At the end of the main method, output a message in a dialog box that says: Hello, We calculated taxes for [number of taxpayers].replace [number of taxpayers] with the actual number of taxpyers you calculated taxes for.
View Replies
View Related
Jun 23, 2014
I am in my first Java class and this is the second assignment. I am supposed to write a program that prints a table of squares and cubes and also uses dialog boxes for the input and the output. The output should look like this:
0 0 0
1 1 1
2 4 8
3 3 27
. . .
. . .
. . .
10 100 1000
I've figured it out but my only problem is the output dialog box displays each row individually (a new dialog box pops up for each row). How do I get it to display the whole table???Here's my code:
Java Code: import java.util.Formatter;
import javax.swing.JOptionPane;
public class Homework2 {
public static void main(String[] args) {
[code]....
View Replies
View Related
Mar 19, 2014
How can I display a modal dialog in JSF 2.0 without using any faces like primefaces, icefaces...
View Replies
View Related
Jan 17, 2015
I have managed to write the program where the user can input kg and the formula converts it into lbs. I have also written a program where I can get a dialog box to appear to ask the user to input the kg, but I can't figure out how to combine the two.
This program allows the user to input the kg, it converts it to lbs and then displays the output:
import java.util.Scanner;
import javax.swing.JOptionPane;
//creates a dialog box
public class convert {
public static void main(String args[]) {
[Code] ....
This program only brings in the first variable and the initial dialog box:
import java.util.Scanner;
import javax.swing.JOptionPane;
//creates a dialog box
public class KgLbs {
public static void main(String args[]) {
[Code] ...
I have attached the actual assignment and what the program should look like.
View Replies
View Related
Feb 20, 2014
The below program ask the user to enter the value of x 1 , Y 1 and radius in separate boxes , What would look nice is if the user can Enter the Value X ,Y and radius in the same box.
import javax.swing.JOptionPane;
public class C3E29GeometryTwoCircles {
public static void main(String[] args) {
// Ask the user to enter the x1 coordinate.
String strNumber = JOptionPane.showInputDialog("Enter the value of x1 coordinate " );
double x1 = Double.parseDouble(strNumber);
strNumber = JOptionPane.showInputDialog("Enter the value of y1 coordinate " );
double y1 = Double.parseDouble(strNumber);
[code]...
View Replies
View Related
Jul 16, 2014
I have to return the minimum and maximum value entered by the user, so far the program returns the maximum but the minimum stays at 0. I assigned 0 to the min and max variables. I believe that is part of the problem, but why do I get an accurate answer on the max if both variables are assigned to 0?
int min = 0;
int max = 0;
int option = JOptionPane.YES_OPTION;
while ( option == JOptionPane.YES_OPTION){
String dataString = JOptionPane.showInputDialog("Enter an integer");
int data = Integer.parseInt(dataString);
if ( min > Integer.parseInt(dataString)) min = Integer.parseInt(dataString);
if ( max < Integer.parseInt(dataString)) max = Integer.parseInt(dataString);
option =JOptionPane.showConfirmDialog(null, "Continue?");
}
JOptionPane.showMessageDialog(null, "Minimum: " + min + "
Maximum: " + max);
}
View Replies
View Related
Jul 6, 2012
I have an application that has a text field I want to use Jfilechooser to save or save As the data.
If the file already exisits i want the end user to be able to hit save without the dialog box popping up asking for a file name folder etc, like it would in MS Word etc..
Is this possible?
View Replies
View Related
Aug 11, 2014
I am wondering why , when I click on the "Add Student" button on the GUI,the message dialog is not popping up.
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
[Code] ......
View Replies
View Related
Dec 9, 2014
I found different ways to code this for a button named "closeButton":
- closeButton.getRootPane().setDefaultButton(closeButton);
- thisDialog.getRootPane().setDefaultButton(closeButton);
- SwingUtilities.getRootPane(closeButton).setDefaultButton(closeButton);
Which is best?
View Replies
View Related
Feb 28, 2015
The goal of this section of my assignment is to ask the user for a password. The password entered has to match the password I set in the code. If it is correct the next dialog box will pop up.
my password is set to:
String enterpwd = "";
String correctPassword = "Setpassword";
I am asked to use JOption, I completed as follows:
enterpwd = JOptionPane.showInputDialog(""............JOptionPane.QUESTION_MESSAGE);
then I use IF statements
if (enterpwd == correctPassword)
xyz = JOption .......();
I am getting an error "java.lang.NumberFormatException: For input string: """
View Replies
View Related
Aug 31, 2014
My program never compiled. the code is for a dialog box that calculates the volume of a cylinder, and i know there are simpler codes to do it, but this is the format my teacher wants...Heres the code:
import javax.swing.*;
public class classTwo
{
public static void main(String[] args)
{
String rad, hei, vol;
Scanner joe = new Scanner(System.in);
System.out.println ("Hi, please enter a radius.");
double rad = joe.nextLine();
System.out.println ("Enter a height.");
[code]....
View Replies
View Related
Jul 1, 2014
After some fiddling, I have the visual format that I want for my dialog.
First, I had to set the scrollHeight for the dataTable to 25% to get have the whole scrollable table contained in the dialog. Why 25%? What is that relative to?
Second, I had to use the !important declaration for the width and height of the dialog to get the sizing to take. Is that normal with PrimeFaces when styling using a CSS class?
<p:dialog widgetVar="notesDialog" header="Handset Notes"
styleClass="notesDialog">
<p:dataTable id="notesTable" widgetVar="notesTable"
var="note" value="#{handsetBean.handsetNotes}"
scrollable="true" resizableColumns="false"
scrollHeight="25%">
[Code] ....
View Replies
View Related
Oct 20, 2014
I need to validate an input box so that the user can enter only round numbers.
The user can't enter any other characters except 0 to 9, they shouldn't be able to enter decimal points either.
They would be answering questions like, 'What is 7 times 8?'
Also, I need to validate it so that the program doesnt crash if they leave the input box blank or empty.
View Replies
View Related
Apr 1, 2015
This assignment uses the following description to implement a Dialog class for the Leap Year Problem. We need to decompose this problem into 2 classes:
1.The Date.java class: is a public class that represents a date composed of a month , day, and a year. So you need to declare month, day, and year as integers. Date has 1 constructor and 4 methods. Write the constructor for Date which has 3 parameters: int m, int d, int y ; (As an example of a constructor with 2 parameters for example chapter 3 page 152 code listing 3-13 has a perfect example for you to use which is the BankAccount.java.) and the 4 methods:
"dayIs()" which returns a day. It has no parameter.
"monthIs()" which returns a month. It has no parameter.
"yearIs()" which returns a year. It has not parameter.
"isLeapYear()" which returns a boolean value.
"isLeapYear()" has one parameter year and returns a boolean. Write the method isLeapYear() knowing that a year is defined to be a leapyear it is a multiple of 4, and if it is is a multiple of 100, it must also be a multiple of 400. isLeapYear() thus decides when a year is a leap year. (see the discussion on "Hints for Assign5" to discover specific examples of a LeapYear).
The purpose of the Date.java is to decide whether a year is a leap year. Here is a definition of when a year is considered a leap year :
-year y1 is a leap year if it is multiple of 4.
-year y1 is a leap year if it is a multiple of 100, it must be a multiple of 400.
-Otherwise y1 is not a leap year.
2. The DateJDialog.java class: implements the GUI. Please use the Dialog boxes developed in the book in chapter2 in pages 99-100 in the code-listing 2-32 (NamesDialog.java) for input and output.
Remember that you will prompt the user to enter:
-a month;
-a day;
-a year
And out of these 3 you will be able to create a Date. Then you will use the dialog box to tell the user whether the year entered was a leapyear or not a leapyear.
Remember that we defined in 1- what it means a year is a leap year or not a leap year.
Do not forget to compile the 2 java files. To verify that the DateJDialog.java works, in TextPad after you compile DateJDialog.java, Click on Tools, Click on "Run Java Application".
When you have completed the assignment, please remember to submit Date.java and DateJDialog.java.
View Replies
View Related
Dec 28, 2014
I have a question and wasn't able to find what I needed through the search. I am currently using Netbeans 8.0 and working on a desktop app. I have a main GUI file where I am going to add a menu item that can be clicked to open up an "About" Dialog box. The problem is, I don't know how to do this
The file are...
MainGui.java
About.java
How would I go about opening the About.java when clicking on a menu item? I tried using...
new About();
About.setVisible(true);
But this just gave a compilation error.
View Replies
View Related
Oct 22, 2014
My application (e.g., the print dialog box) needs to support multiple languages (user selected either at starting application or by switch in code).
How can this be achieved under Windows 7, Enterprise (works OK under Linux). I have tried : E.g.,
Locale.setDefault( .. );
JComponent.setDefaultLocale(Locale.LANG);
Setting resource bundle
but to no avail. The application always inherit the Win 7 system locale.
View Replies
View Related
Feb 17, 2015
I am a newbie in java prgmming using netbeans IDE . I have a code Java Code:
List<String> files = service.getSecureCloudStoragePort().listFiles();
SelectFileDialog dialog = new SelectFileDialog(this.getFrame(),true,files); mh_sh_highlight_all('java');
My files value get as :
[1_car.txt@2, 5_Van.txt@6]
The 2 and 6 refers user id ... I need to show only particular user with his own id.
So need to filter the files value with that id (after @ in raw data) .. How it can do ? any method to filter the data . That data format could not be changed in any way...
View Replies
View Related
Apr 23, 2014
When the application starts and the index page is initially loaded, dialog is not shown correctly (panel is not shown) and shows that selected==null. But in debugger prepareSelect seems working correctly and selected is initialised (not null). When I reload page, dialog is shown correctly.
Below are facelets for the page composition and backing bean code.
Register.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
[Code] .....
View Replies
View Related
Nov 7, 2014
I am creating a set of 3 subclasses, 1 superclass, and an application. In my instructions it says to make set methods in my super and subclass by using dialog boxes. In the application you have 3 different arrays where you create objects and are supposed to call the methods from the subclasses to be used in the application. I don't know how to make the dialog boxes from my subclasses to show up in my application.
View Replies
View Related
Feb 27, 2014
I am learning java and I have Assignment on how to implement a open dialog for menubar button ... how i can step in ...
View Replies
View Related
Apr 14, 2015
I am using the JavaFX dialogs. I have made a dialog as follows:
Alert d = new Alert(AlertType.CONFIRMATION);
d.setTitle(Resources.R(Resources.DELETE_DATA_SOURCE));
d.setHeaderText(...);
I want to make part of the header text bold -- I want a message like "Really delete X" where X is in bold.
Is there any way to do this with a dialog (other than rolling my own?).
View Replies
View Related
Apr 14, 2015
I have a Dialog with no buttons (the dialog pane contains some graphic elements which act as my buttons). I show the dialog and try to click the close window button on the dialogs title bar, and the dialog does not close! I read the docs and it appears that only dialogs that have one or more buttons can be abnormally closed (and only under certain well defined sensible conditions). How can I abnormally close a dialog with no buttons?
View Replies
View Related
May 1, 2015
I want to create a button bar that is the same as the confirmation dialog button bar -- so an OK and cancel button layed out in the platform specific way, and with the same styling.
I have made some progress via a hack -- create an alert dialog, and extract the buttons in the dialog using lookupButton, and then put those buttons in a toolbar. But this doesn't necessarily get a toolbar with the buttons in the correct order. If I could get the button bar out of an alert dialog I would have a solution, but I can't see to do that.
View Replies
View Related
Aug 9, 2001
I am wondering how to do the following:when a user clicks on a save menu item, a save JFileChooser pops up. I would like to have a default file name set in the FileName box on the chooser, similar to what applications like Microsft word has. Right now, no file name will appear until the user has selected a file.I also need to know how to get the text from this box in the case that the user enters a new file name (the getSelection function is not useful here because the user will not have selected an existing file.)
View Replies
View Related
Feb 19, 2013
I am new to JSF and I am working on handling session timeout for a JSF application. I am trying to get the code to work for ajax calls and not able to achieve that so far. I have tried two approaches:
Approach 1: SessionListener (for cleanup work) and SessionFilter (for filtering every request and checking if session timed out)
My Code snippet of doFilter() of SessionFilter:
if ((request instanceof HttpServletRequest)
&& (response instanceof HttpServletResponse)) {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
// is session expire control required for this request? (not required for home page or timeout page or JSF resources)
if (isSessionControlRequired(httpServletRequest)) {
[Code] .....
Both these approaches work for non-ajax POST calls but not for ajax calls. When I run my app in debug mode, I can step through all the statements for ajax calls also, which gives me an idea that the control does come to my code, executes it but for some reason, nothing happens on the UI.
I have been trying to redirect user to a timeout page but the ideal thing would be to display a JSF dialog and upon hitting 'OK' take user to Home Screen (My app does not have a login screen.) I have a basic questions also, is view expiring exactly same as session timeout?
View Replies
View Related