我现在有2个窗户.用户单击"提交"按钮后,将显示"主窗口",但它显示为:

代码是:LoginForm.java
package interfaceGUI;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class LoginForm extends JFrame{
private JLabel loginEmail;
private JLabel loginPass;
private JTextField loginTextField;
private JPasswordField loginPassField;
private JButton submit;
private JPanel loginArea;
private JPanel buttonArea;
public LoginForm()
{
super("Party Supplies Rental");
setLayout(new FlowLayout());
loginEmail = new JLabel("Enter Your Email Address: ");
loginTextField = new JTextField(20);
loginPass = new JLabel("Enter Your Password: ");
loginPassField …Run Code Online (Sandbox Code Playgroud) 这是我写的代码.当我输入一个小写字符,如'a'时,它给我一个空白字符,但之后它运作良好.你能告诉我我做错了什么吗?谢谢.:)
#include <iostream>
#include <string>
using namespace std;
int main()
{
char letter;
cout << "You will be asked to enter a character.";
cout << "\nIf it is a lowercase character, it will be converted to uppercase.";
cout << "\n\nEnter a character. Press . to stop: ";
cin >> letter;
if(islower(letter))
{
letter = isupper(letter);
cout << letter;
}
while(letter != '.')
{
cout << "\n\nEnter a character. Press . to stop: ";
cin >> letter;
if(islower(letter))
{
letter = …Run Code Online (Sandbox Code Playgroud) 我最近在学习Java,所以我开始将我的程序用C++转换成Java,但是当我计算距离时,我得到了NaN作为答案.谁能告诉我这里的问题是什么?谢谢.以下是代码:
import java.util.Scanner;
import java.lang.Math;
public class Labsheet1Number1 {
public static void main(String[] args) {
double length=0,height=0,pi=3.142;
double distance=0,angle=0;
Scanner input = new Scanner(System.in);
System.out.println("This program will calculate the distance and the angle.");
System.out.print("Enter the length of the ladder: ");
length = input.nextInt();
System.out.print("Enter the height of the wall: ");
height = input.nextInt();
distance = Math.sqrt(Math.pow(length, 2) - Math.pow(height, 2));
angle = (180/pi) * (Math.sin(height/length));
System.out.println("The distance is " + distance);
System.out.println("The angle is " + angle);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将数字1-10的平方输出到名为Squares的文件中,但我对该OutputStream.print(i+"\t"+(i*i));部件有错误.印刷品有下划线,我不明白为什么.请帮我.
这是代码:
import java.util.*;
import java.io.*;
public class Number1 {
public static void main(String[] args) throws FileNotFoundException {
FileOutputStream fos = new FileOutputStream("Squares.txt");
PrintWriter square;
try{
square = new PrintWriter(fos);
} catch (Exception e) {
System.out.print("Could not create/open file");
System.exit(0);
}
for(int i=1; i<=10; i++)
{
OutputStream.print(i+"\t"+(i*i));
}
}
}
Run Code Online (Sandbox Code Playgroud)
完整解决方案
import java.io.*;
public class Number1 {
public static void main(String[] args) throws FileNotFoundException {
FileOutputStream fos = new FileOutputStream("Squares.txt");
PrintWriter square = null;
try{
square = new …Run Code Online (Sandbox Code Playgroud) 我试图将奇数存储在一个数组中,但是当我运行代码时,我得到了9五次作为答案.它只存储价值9.
以下是代码:
public class Number2 {
public static void main(String[] args) {
int[] element = new int[5];
for(int i=0; i<5; i++) {
for(int j=1; j <= 10; j=j+2) {
element[i] = j;
}
}
for(int i=0; i < 5; i++) {
System.out.println(element[i]);
}
}
}
Run Code Online (Sandbox Code Playgroud)
你能告诉我我的课程有什么问题吗?
我目前正在开发一个绘图应用程序,允许用户单击并拖动以确定形状的大小,并且还能够使用绘制的形状进行转换.这是我到现在为止的截图:

我将轴定位在画布的中心,但现在我想在中心写(0,0).正如你所看到的,我写的CSS只会让它出现在顶部,但我希望它在中心.这是我的transformation.html代码:
<!DOCTYPE html>
<head>
<title>Drawing Application</title>
<link href="transform.css" rel="stylesheet">
</head>
<body>
<canvas id="myCanvas" width="1000" height="500"></canvas>
<span style="margin-left:820px; margin-top:500px;">(0,0)</span> <!--tried with some CSS-->
<br><output id="out"></output>
<script src="transform.js"></script>
<div id="shapeProperties">
<p>
<label>
<div id="shape">
<p><b>Fill shapes option:</b> <input type="checkbox" id="fillType"></b><br/>
<p><b><center><u>Shapes</u></center></b>
<p>Polygon <input type="checkbox" id="polyBox"><br/>
</div>
<div id="color">
<b><p><center><u>Color Properties</u></center></b><br/>
<p>Fill Color <input type="color" id="fillColor" value="#000000"/><br/>
<p>Stroke Color <input type="color" id="strokeColor" value="#000000"/><br/>
</div>
<div id="range">
<b><p><center><u>Other Properties</u></center></b><br/>
<label>Polygon Sides <input type="range" id="polygonSide" step="1" min="3" max="9" value="3"></label>
</div>
<div id="clear">
<p> <center><input id="clearCanvas" …Run Code Online (Sandbox Code Playgroud)