昆仑山:眼中无形心中有穴之穴人合一

夫君子之行,静以修身,俭以养德;非澹泊无以明志,非宁静无以致远。夫学须静也,才须学也;非学无以广才,非志无以成学。怠慢则不能励精,险躁则不能冶性。年与时驰,意与岁去,遂成枯落,多不接世。悲守穷庐,将复何及!

 

java-GUI操作


import javax.swing.*;
import java.awt.*;

public class LinesRectsOvalsJPanel extends JPanel {

    @Override
    public void paintComponent(Graphics graphics){
        super.paintComponent(graphics);
       // this.setBackground(Color.ORANGE);
        //画直线
        graphics.drawLine(5,30,380,30);

        //画矩形
        graphics.drawRect(5,40,90,55);
       // graphics.clearRect(5,40,90,55);
        graphics.fillRect(100,40,90,55);
        //画  圆角矩形
        graphics.fillRoundRect(195,40,90,55,50,50);
        graphics.drawRoundRect(290,40,90,55,20,20);

        //画突起矩形
        graphics.setColor(Color.CYAN);
        graphics.draw3DRect(5,100,90,55,true);//画一个突出显示的矩形。其中x和y指定矩形左上角的位置,参数width和height是矩形的宽和高,参数raised是突出与否
        graphics.setColor(Color.green);
        graphics.fill3DRect(100,100,90,55,false);//用预定的颜色填充一个突出显示的矩形。

        //画椭圆
        graphics.setColor(Color.BLUE);
        graphics.drawOval(195,100,90,55);
        graphics.fillOval(290,100,90,55);

    }

}
/*
 参考地址:
 https://www.jb51.net/article/73136.htm
 */




import javax.swing.*;
import java.awt.*;

public class Driver {
    public static void main(String[] args) {
        JFrame jFrame=new JFrame("LinesRectsOvalsJPanel");

        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置用户在此窗体上发起 "close" 时默认执行的操作
        LinesRectsOvalsJPanel linesRectsOvalsJPanel=
                new LinesRectsOvalsJPanel();

        linesRectsOvalsJPanel.setBackground(Color.PINK);//背景色代码

        jFrame.add(linesRectsOvalsJPanel);

        jFrame.setSize(640,480);//窗口大小

        jFrame.setVisible(true);//运行需要窗口显示
    }
}



posted on 2018-11-09 13:59  Indian_Mysore  阅读(136)  评论(0编辑  收藏  举报

导航