「java高级设计图」高级设计图纸

博主:adminadmin 2022-12-21 08:12:06 81

本篇文章给大家谈谈java高级设计图,以及高级设计图纸对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

Java编程 设计一个图形用户界面。界面包括三个单选按钮、两个复选框、一个列表、一个文本区和一个按

程序如下:

import java.awt.FlowLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;

import javax.swing.JButton;

import javax.swing.JCheckBox;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.JRadioButton;

import javax.swing.JTextArea;

public class JFrameDemo extends JFrame implements ActionListener

{

private JPanel panel;

private JButton button;

private JTextArea textArea;

private JCheckBox musicBox;

private JCheckBox danceBox;

private JRadioButton hanButton;

private JRadioButton manButton;

private JRadioButton huiButton;

private ButtonGroup buttonGroup;

public JFrameDemo()

{

panel = new JPanel();

button = new JButton("确定");

textArea = new JTextArea(40,30);

musicBox = new JCheckBox("唱歌");

danceBox = new JCheckBox("跳舞");

huiButton = new JRadioButton("回族");

hanButton = new JRadioButton("汉族");

manButton = new JRadioButton("满族");

buttonGroup = new ButtonGroup();

buttonGroup.add(huiButton);

buttonGroup.add(hanButton);

buttonGroup.add(manButton);

panel.setLayout(new FlowLayout(3));

panel.add(huiButton);

panel.add(hanButton);

panel.add(manButton);

panel.add(musicBox);

panel.add(danceBox);

panel.add(button);

panel.add(textArea);

add(panel);

setTitle("选择兴趣爱好");

setBounds(100, 100, 400, 280);

setResizable(false);

setVisible(true);

this.button.addActionListener(this);

}

public static void main(String[] args)

{

new JFrameDemo();

}

@Override

public void actionPerformed(ActionEvent e)

{

if(e.getSource() == this.button)

{

String info = "";

if(this.huiButton.isSelected())

{

info += this.huiButton.getText() + "\n";

}

if(this.hanButton.isSelected())

{

info += this.hanButton.getText() + "\n";

}

if(this.manButton.isSelected())

{

info += this.manButton.getText() + "\n";

}

if(this.danceBox.isSelected())

{

info += this.danceBox.getText() + "\n";

}

if(this.musicBox.isSelected())

{

info += this.musicBox.getText() + "\n";

}

this.textArea.setText(info);

}

}

}

有问题欢迎提问,满意请采纳,谢谢!

java设计图形(Shape)类及其子类(Circle、Rectangle)

你好,刚好闲着帮你写一个:

Shape类:

public class Shape {

protected Point location;

public Shape(){

}

public double area(){

return 0.0;

}

}

Circle类:

public class Circle extends Shape{

private int r;

public Circle() {

}

public Circle(Point center,int r) {

super.location=center;

this.r = r;

}

public double area() {

return Math.PI*r*r ;

}

}

Rectangle类:

public class Rectangle extends Shape{

private int width;

private int height;

public Rectangle() {

}

public Rectangle(Point o,int width, int height) {

location=o;

this.width = width;

this.height = height;

}

public double area() {

return width*height;

}

}

我这里图方便,在创建圆的时候直接用圆心和半径创建,还有矩形也是用一个点位置和长宽创建,所以还要加一个点类:

public class Point {

public int x;

public int y;

public Point() {

}

public Point(int x, int y) {

this.x = x;

this.y = y;

}

}

java 架构设计图用什么软件

架构图用office家族的visio最牛逼,各种图都可以画出来。

用VISIO画的分层架构设计图

关于java高级设计图和高级设计图纸的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

The End

发布于:2022-12-21,除非注明,否则均为首码项目网原创文章,转载请注明出处。