viewcolors.java

来自「java源程序 对初学者有很大的帮助 从简单到复杂」· Java 代码 · 共 34 行

JAVA
34
字号
//********************************************************************
//  ViewColors.java       Authors: Lewis/Loftus
//
//  Demonstrates the use slider components.
//********************************************************************

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

public class ViewColors
{
   //-----------------------------------------------------------------
   //  Presents up a frame with a control panel and a panel that
   //  changes color as the sliders are adjusted.
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
      JFrame frame = new JFrame ("View Colors");
      frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

      JPanel colorPanel = new JPanel();
      colorPanel.setPreferredSize (new Dimension (100, 100));
      colorPanel.setBackground (new Color (0, 0, 0));

      Container cp = frame.getContentPane();
      cp.setLayout (new FlowLayout());
      cp.add (new ViewSliderPanel(colorPanel));
      cp.add (colorPanel);

      frame.pack();
      frame.show();
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?