Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
What is wrong in the following code: package oren; import java.util.Scanner; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { double x,y,z...
#6: Post edited
java swing + console . JOptionPane doesn't show
- JOptionPane doesn't show; application combines Swing and console.
what is wrong in the following code:- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
For some reason the JOptionPane.showMessageDialog doesn't show.I am using eclipse and java 21.
- What is wrong in the following code:
- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
- For some reason the `JOptionPane.showMessageDialog` doesn't show.
- However, there are no error messages.
- I am using Eclipse and Java 21.
#5: Post edited
java swing + console wrong behaviour. what is the problem?
- java swing + console . JOptionPane doesn't show
#4: Post edited
- what is wrong in the following code:
- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
For some reason the JOptionPane.showMessageDialog never run.- I am using eclipse and java 21.
- what is wrong in the following code:
- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
- For some reason the JOptionPane.showMessageDialog doesn't show.
- I am using eclipse and java 21.
#3: Post edited
- what is wrong in the following code:
- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
For some reason the JOptionPane.showMessageDialog never run.
- what is wrong in the following code:
- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
- For some reason the JOptionPane.showMessageDialog never run.
- I am using eclipse and java 21.
#2: Post edited
java swing + console wrong behaviour. what is the problem?
- what is wrong in the following code:
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- For some reason the JOptionPane.showMessageDialog never run.
- what is wrong in the following code:
- ```
- package oren;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- double x,y,z;
- Scanner scanner = new Scanner(System.in);
- System.out.println("what are the x and y side of the triangle");
- x = scanner.nextDouble();
- scanner.nextLine();
- y = scanner.nextDouble();
- scanner.nextLine();
- scanner.close();
- JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
- }
- }
- ```
- For some reason the JOptionPane.showMessageDialog never run.
#1: Initial revision
java swing + console wrong behaviour. what is the problem?
what is wrong in the following code:
package oren;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
double x,y,z;
Scanner scanner = new Scanner(System.in);
System.out.println("what are the x and y side of the triangle");
x = scanner.nextDouble();
scanner.nextLine();
y = scanner.nextDouble();
scanner.nextLine();
scanner.close();
JOptionPane.showMessageDialog(null, Math.sqrt(x*x + y*y));
}
}
For some reason the JOptionPane.showMessageDialog never run.
