美术

当前位置:北京快三 > 美术 > 小项目分享---混色器

小项目分享---混色器

来源:http://www.yylbdq.com 作者:北京快三 时间:2019-11-27 01:29

编写代码的同志们一般懂美术的就少了,偶也是,什么色轮、三维加色等等。虽然看过一些书籍(如内田广由纪的《配色基础原理》),不过还是一知半解的。

java 编译出现找不到符号错误
//导入包
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import static java.awt.BorderLayout.*;
import javax.swing.JScrollPane;
import java.awt.ScrollPane;
import java.awt.*;
import java.awt.Color.*;
import javax.swing.BorderFactory;
import java.awt.Label.*;
import javax.swing.JSplitPane.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFileChooser.*;
import javax.swing.JLabel.*;
public class JieMian
{
//定义组件
JFrame jf = new JFrame("FTP文件传输软件");
北京快三,JPanel jl=new JPanel();
JPanel jl1=new JPanel();
JPanel jl2=new JPanel();
JPanel jl3=new JPanel();
JPanel jl4=new JPanel();
JPanel jl5=new JPanel();
JPanel jl6=new JPanel();
JPanel jl7=new JPanel();
JPanel jl8=new JPanel();
JPanel jl9=new JPanel();
JPanel jl10=new JPanel();
JButton jb=new JButton;
JButton jb1=new JButton;
JButton jb2=new JButton;
JButton jb3=new JButton;
JButton jb4=new JButton;
JButton jb5=new JButton;
JButton jb6=new JButton;
JButton jb7=new JButton;
JButton jb8=new JButton;
JButton jb9=new JButton;
JButton jb10=new JButton;
JTextField jtf=new JTextField;
JTextField jtf1=new JTextField;
JTextField jtf2=new JTextField;
JTextField jtf3=new JTextField;
JTextField jtf4=new JTextField;
JTextField jtf5=new JTextField;
JTextArea jta =new JTextArea;
JScrollPane jsp=new JScrollPane();
public void init()
{
// 为按钮添加背景颜色
jb.setBackground(Color.GRAY);
//设置jl面板的组建排列的方式
jl.setLayout(new BorderLayout;
//设置边框
jl1.setBorder(BorderFactory.createLoweredBevelBorder;
jl4.setBorder(BorderFactory.createRaisedBevelBorder;
jl3.setBorder(BorderFactory.createEtchedBorder;
jl3.setPreferredSize(new Dimension);
jl4.setPreferredSize(new Dimension);
jf.add;
jl.add(jl1,NORTH);
jl.add(jl2,SOUTH);
jl2.setLayout(new BorderLayout;
jl2.add;
jl2.add;
jl3.setLayout(new BorderLayout;
jl3.add(jl5,NORTH);
jl5.setLayout(new FlowLayout;
jl5.add(new Label;
jl5.add;
jl4.setLayout(new BorderLayout;
jl4.add(jl6,NORTH);
jl6.setLayout(new FlowLayout;
jl6.add(new Label;
jl6.add;
jl3.add(jl7,SOUTH);
jl7.setBorder(BorderFactory.createRaisedBevelBorder;
jl7.setPreferredSize(new Dimension);
jl7.setLayout(new BorderLayout;
jl7.add(jl8,NORTH);
jl8.setLayout(new FlowLayout;
jl8.add;
jl8.add;
jl8.add;
jl8.add;
jb1.setBackground(Color.lightGray);
jb2.setBackground(Color.lightGray);
jb3.setBackground(Color.lightGray);
jb4.setBackground(Color.lightGray);
jb5.setBackground(Color.lightGray);
jb6.setBackground(Color.lightGray);
jb7.setBackground(Color.lightGray);
jb8.setBackground(Color.lightGray);
jb9.setBackground(Color.lightGray);
jb10.setBackground(Color.lightGray);
jb1.setPreferredSize(new Dimension;
jb2.setPreferredSize(new Dimension;
jb3.setPreferredSize(new Dimension;
jb4.setPreferredSize(new Dimension;
jb5.setPreferredSize(new Dimension;
jb6.setPreferredSize(new Dimension;
jb7.setPreferredSize(new Dimension;
jb8.setPreferredSize(new Dimension;
jb9.setPreferredSize(new Dimension;
jb10.setPreferredSize(new Dimension;
jl4.add(jl9,SOUTH);
jl9.setPreferredSize(new Dimension);
jl9.setLayout(new BorderLayout;
jl9.add(jl10,NORTH);
jl9.add;
jl9.setLayout(new FlowLayout;
jl10.add;
jl10.add;
jl10.add;
jl10.add;
jl10.add;
jl10.add;
jl1.setLayout(new FlowLayout;
//将组件添加到JL1面板上面
jl1.add(new Label;
jl1.add;
jl1.add(new Label;
jl1.add;
jl1.add(new Label;
jl1.add;
jl1.add(new Label;
jl1.add;
jl1.add;
jb1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JFileChooser jfc=new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );
jfc.showDialog(new JLabel;
File file=jfc.getSelectedFile();
if(file.isDirectory{
System.out.println("文件夹:"+file.getAbsolutePath;
}else if(file.isFile{
System.out.println("文件:"+file.getAbsolutePath;
}
System.out.println(jfc.getSelectedFile().getName;
}
});
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

下面这些专业配色工具一直也不怎么会用。

jf.pack();
jf.setVisible;
}
public static void main(String[] args)
{
new JieMian;
}
}

北京快三 1

---------- 编译Java程序 ----------

北京快三 2

JieMian.java:142: 错误: 找不到符号
JFileChooser jfc=new JFileChooser();
^
符号: 类 JFileChooser
JieMian.java:142: 错误: 找不到符号
JFileChooser jfc=new JFileChooser();
^
符号: 类 JFileChooser
JieMian.java:143: 错误: 找不到符号
jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );
^
符号: 变量 JFileChooser
JieMian.java:144: 错误: 找不到符号
jfc.showDialog(new JLabel;
^
符号: 类 JLabel
4 个错误

北京快三 3

输出完成 - 正常终止

所以,本着程序为生活服务的原则,我用java和c#分别编写了一个混色器。想看看不同比率的颜色混合起来得到的是什么效果么?代码如下,与君分享:

1、Java Applet:

package edu.sx.william;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JScrollBar;

public class SetBakColor extends JApplet implements MouseMotionListener {

    private static final long serialVersionUID = 1L;
    JScrollBar jsb, jsb2, jsb3;
    JLabel jl;
    Container con;
    public void init() {

        Panel pan = new Panel();
        pan.setLayout(new GridLayout(2, 3));
        con = getContentPane();
        con.setLayout(new BorderLayout());
        jsb = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 255);
        jsb2 = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 255);
        jsb3 = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 255);

        jsb.addMouseMotionListener(this);
        jsb2.addMouseMotionListener(this);
        jsb3.addMouseMotionListener(this);

        jl = new JLabel("the RGB color");

        jl.addMouseMotionListener(this);
        pan.add(jsb);
        pan.add(jsb2);
        pan.add(jsb3);
        pan.add(jl);
        con.add(pan,BorderLayout.NORTH);
    }

    @Override
    public void mouseDragged(MouseEvent e) {

本文由北京快三发布于美术,转载请注明出处:小项目分享---混色器

关键词: