色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

您好,歡迎來電子發燒友網! ,新用戶?[免費注冊]

您的位置:電子發燒友網>源碼下載>編譯器/仿真器>

文本編輯器源碼

大小:8 人氣: 2010-08-28 需要積分:10
chumowei的空間

用戶級別:注冊會員

貢獻文章:

貢獻資料:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import javax.imageio.*;
import java.io.*;

public class EditPanel extends JPanel
{
?public EditPanel()
?{??
??JPanel FontPanel = new JPanel();
??JPanel BackColorPanel = new JPanel();
??JPanel TextAreaPanel = new JPanel();
??ImagePanel picturePanel = new ImagePanel();
??
??JtextArea = new JTextArea(20,40);
??jscrollPane = new JScrollPane(JtextArea);
??
??JPopupMenu jpopupMenu = new JPopupMenu();
??JMenuItem CopyItem = new JMenuItem("復制",new ImageIcon("copy.gif"));
??JMenuItem PastItem = new JMenuItem("粘貼",new ImageIcon("paste.gif"));
??JMenuItem CutItem = new JMenuItem("剪切",new ImageIcon("cut.gif"));
??
??Action pictureAction = new PictureAction();??
??CopyItem.addActionListener(pictureAction);
??PastItem.addActionListener(pictureAction);
??CutItem.addActionListener(pictureAction);
??
??CopyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_DOWN_MASK));
??CopyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,InputEvent.CTRL_DOWN_MASK));
??CopyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,InputEvent.CTRL_DOWN_MASK));

??jpopupMenu.add(CopyItem).setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_DOWN_MASK));
??jpopupMenu.add(PastItem).setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,InputEvent.CTRL_DOWN_MASK));
??jpopupMenu.add(CutItem).setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,InputEvent.CTRL_DOWN_MASK));
??
??JtextArea.setComponentPopupMenu(jpopupMenu);


??font = new Font("宋體",Font.PLAIN,12);??
??JLabel TypeLabel = new JLabel("類型:");
??JLabel SizeLabel = new JLabel("大小:");
??JLabel ModelLabel = new JLabel("樣式:");
??
??ColorSlider1 = new JSlider(0,255,0);
??ColorSlider2 = new JSlider(0,255,0);
??ColorSlider3 = new JSlider(0,255,0);
??ColorSlider1.setPaintTicks(true);
??ColorSlider2.setPaintTicks(true);
??ColorSlider3.setPaintTicks(true);
??ColorSlider1.setMajorTickSpacing(51);
??ColorSlider2.setMajorTickSpacing(51);
??ColorSlider3.setMajorTickSpacing(51);
??ColorSlider1.setMinorTickSpacing(3);
??ColorSlider2.setMinorTickSpacing(3);
??ColorSlider3.setMinorTickSpacing(3);
??ColorSlider1.setPaintTicks(true);
??ColorSlider2.setPaintTicks(true);
??ColorSlider3.setPaintTicks(true);
??ColorSlider1.setPaintLabels(true);
??ColorSlider2.setPaintLabels(true);
??ColorSlider3.setPaintLabels(true);
??
??String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().
??getAvailableFontFamilyNames();
??ModelComboBox = new JComboBox(fonts);
??SizeSlider = new JSlider(0,100,12);
??SizeSlider.setMajorTickSpacing(20);
??SizeSlider.setMinorTickSpacing(2);
??SizeSlider.setPaintTicks(true);
??SizeSlider.setPaintLabels(true);
??TypeCheckBox1 = new JCheckBox("常規");
??TypeCheckBox2 = new JCheckBox("傾斜");
??TypeCheckBox3 = new JCheckBox("加粗");
??
??BackColorListener ColorListener = new BackColorListener();
??ActionListener listener = new FontListener();
??TypeCheckBox1.addActionListener(listener);
??TypeCheckBox2.addActionListener(listener);
??TypeCheckBox3.addActionListener(listener);
??ModelComboBox.addActionListener(listener);
??ColorSlider1.addChangeListener(ColorListener);
??ColorSlider2.addChangeListener(ColorListener);
??ColorSlider3.addChangeListener(ColorListener);
??SizeSlider.addChangeListener(new ChangeListener()
??{
???public void stateChanged(ChangeEvent event)
???{
????JtextArea.setFont(new Font((String)ModelComboBox.getSelectedItem(),font.getStyle(),SizeSlider.getValue()));????
???}???
??});
??
??setLayout(new GridBagLayout());
??FontPanel.setLayout(new GridBagLayout());
??BackColorPanel.setLayout(new GridBagLayout());
??TextAreaPanel.setLayout(new BorderLayout());

??add(FontPanel,new View(0,0).setAnchor(View.CENTER).setInsets(5,5,0,5).setIpad(2, 2).setFill(View.HORIZONTAL).setWeight(0, 0));
??add(BackColorPanel,new View(0,1).setAnchor(View.CENTER).setFill(View.HORIZONTAL).setInsets(5).setWeight(0, 0));
??add(picturePanel,new View(0,2).setAnchor(View.CENTER).setFill(View.BOTH).setInsets(5).setWeight(0,100));
??add(TextAreaPanel,new View(1,0,1,4).setWeight(100, 100).setFill(View.BOTH));
??
??TextAreaPanel.add(jscrollPane,BorderLayout.CENTER);
??
??FontPanel.add(TypeLabel,new View(0,0));
??FontPanel.add(SizeLabel,new View(0,1));
??FontPanel.add(ModelLabel,new View(0,2));
??FontPanel.add(TypeCheckBox1,new View(1,0).setAnchor(View.WEST).setInsets(10));
??FontPanel.add(TypeCheckBox2,new View(2,0).setAnchor(View.WEST).setInsets(10));
??FontPanel.add(TypeCheckBox3,new View(3,0).setAnchor(View.WEST).setInsets(10));
??FontPanel.add(SizeSlider,new View(1,1,3,1).setAnchor(View.WEST).setFill(View.HORIZONTAL).setInsets(5));
??FontPanel.add(ModelComboBox,new View(1,2,3,1).setInsets(10));
??
??BackColorPanel.add(ColorSlider1,new View(0,0).setInsets(5).setFill(View.BOTH).setWeight(100, 100).setIpad(5, 5));
??BackColorPanel.add(ColorSlider2,new View(0,1).setInsets(5).setFill(View.BOTH).setWeight(100, 100).setIpad(5, 5));
??BackColorPanel.add(ColorSlider3,new View(0,2).setInsets(5).setFill(View.BOTH).setWeight(100, 100).setIpad(5, 5));

??Border LowerBorder = BorderFactory.createLoweredBevelBorder();
??Border AreaTextTitle = BorderFactory.createTitledBorder(LowerBorder, "文本框");
??jscrollPane.setBorder(AreaTextTitle);
??
??Border EtchedBorder = BorderFactory.createEtchedBorder();
??Border FontTitle = BorderFactory.createTitledBorder(EtchedBorder, "字體");
??FontPanel.setBorder(FontTitle);
??
??Border BackColorTitle = BorderFactory.createTitledBorder(EtchedBorder, "背景");
??BackColorPanel.setBorder(BackColorTitle);
?}
?
?public JTextArea getTextArea ()
?{
??return JtextArea;??
?}
?private class FontListener implements ActionListener
?{
??public void actionPerformed(ActionEvent event)
??{
???int map = 0;
???if(TypeCheckBox1.isSelected())
???{
????map = Font.PLAIN;
????TypeCheckBox2.setSelected(false);
????TypeCheckBox3.setSelected(false);
????font = font.deriveFont(map);
???}
???if(TypeCheckBox2.isSelected())
???{
????map +=Font.ITALIC;
????TypeCheckBox1.setSelected(false);
????font = font.deriveFont(map);
???}
???if(TypeCheckBox3.isSelected())
???{
????map +=Font.BOLD;
????TypeCheckBox1.setSelected(false);?
????font = font.deriveFont(map);
???}
???JtextArea.setFont(new Font((String)ModelComboBox.getSelectedItem(),font.getStyle(),SizeSlider.getValue()));
??}??
?}
?private class BackColorListener implements ChangeListener
?{
??public void stateChanged(ChangeEvent event)
??{
???int a = ColorSlider1.getValue();
???int b = ColorSlider2.getValue();
???int c = ColorSlider3.getValue();
???JtextArea.setBackground(new Color(a,b,c));
??}??
?}
?private class PictureAction extends AbstractAction
?{
??public void actionPerformed(ActionEvent event)
??{
???System.out.println(getValue(Action.NAME) + "按鈕被選擇了!");
??}
?}
???? class ImagePanel extends JPanel
?{?
??? public ImagePanel()
??? {?
?????? // acquire the image
?????? try
?????? {
????????? image = ImageIO.read(new File("heihei.gif"));
?????? }
?????? catch (IOException e)
?????? {
????????? e.printStackTrace();
?????? }
??? }
???
??? public void paintComponent(Graphics g)
??? {?
?????? super.paintComponent(g);
?????? if (image == null) return;
???
?????? int imageWidth = image.getWidth(this);
?????? int imageHeight = image.getHeight(this);

?????? // draw the image in the upper-left corner
??????
?????? g.drawImage(image, 0, 0 ,this.getWidth(),this.getHeight(),null);
?????? // tile the image across the panel
??? }
?}

?private JTextArea JtextArea;
?private Font font;
?private JCheckBox TypeCheckBox1;
?private JCheckBox TypeCheckBox2;
?private JCheckBox TypeCheckBox3;
?private JSlider SizeSlider;
?private JComboBox ModelComboBox;
?private JSlider ColorSlider1;
?private JSlider ColorSlider2;
?private JSlider ColorSlider3;
?private JScrollPane jscrollPane;
?private Image image;

}

非常好我支持^.^

(0) 0%

不好我反對

(0) 0%

文本編輯器源碼下載

相關電子資料下載

      發表評論

      用戶評論
      評價:好評中評差評

      發表評論,獲取積分! 請遵守相關規定!

      ?
      主站蜘蛛池模板: 性VIDEOSTV另类极品| 青年医生插曲| 午夜免费福利小电影| 成人性生交大片免费看中文 | 无限资源在线观看完整版免费下载| 精品免费视在线视频观看| VIDEOSGGRATIS欧美另类| 亚洲青青草原| 视频一区精品自拍亚洲| 美女图片131亚洲午夜| 国产在线精品视亚洲不卡| 亚洲最大成人| 蜜桃臀无码内射一区二区三区 | 亚洲不卡视频在线| 青青草原在线新免费| 久久久久久久久免费视频| 国产精品久久自在自2021| G0GO人体大尺香蕉| 天天看学生视频| 精品午夜国产福利观看| 国产成人精选免费视频| 亚洲综合日韩中文字幕v在线| 十分钟免费看完整视频| 欧美在线激情| 国产无遮挡又黄又爽在线视频| 伊人网综合网| 日韩毛片大全| 久久精品亚洲热综合一本| 国产探花在线精品一区二区| 国产AV精品久久久免费看| 动漫美女被h动态图| 不知火舞vs精子| 亚洲中文无码AV在线观看| 午夜伦理电影在线观免费| 色婷婷国产麻豆AV| 日韩欧无码一区二区三区免费不卡 | 成视频高清| 补课H湿 1V1 PLAY| 成人免费在线观看| 成人人观看的免费毛片| 成人在线高清不卡免费视频|