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

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

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

文本編輯器源碼

大?。?/span>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%

文本編輯器源碼下載

相關電子資料下載

      發表評論

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

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

      ?
      主站蜘蛛池模板: 战狼4在线观看完免费完整版 | 两个洞一起插哦!好刺激 | 视频一区国产在线第一页 | 亚洲免费视频在线 | 暖暖日本大全免费观看 | 老师掀开短裙让我挺进动态 | 国产精品一区二区三区四区五区 | 欧美丰满熟妇无码XOXOXO | 内射白嫩少妇超碰 | 久久sese| 男人一进一出桶女人视频 | 日本三区四区免费高清不卡 | 欧美伦理片第7页 | 在线欧美 精品 第1页 | 姑娘视频日本在线播放 | 亚洲精品国产自在在线观看 | 天天影视网网色色欲 | 一边啪啪的一边呻吟声口述 | 披黑人猛躁10次高潮 | 成人在免费视频手机观看网站 | 东热rq大乱交 | 国产在线精品视亚洲不卡 | 肉色欧美久久久久久久蜜桃 | 久久久久久91香蕉国产 | 久久精品国产亚洲精品2020 | 午夜深情在线观看免费 | 中文字幕无码A片久久 | 亚洲AV无码专区国产乱码网站 | 国产亚洲精品久久久久久白晶晶 | 午夜福利视频极品国产83 | 国产亚洲日韩在线播放不卡 | 内射白嫩少妇超碰 | 婷婷综合久久狠狠色 | 亚洲中文字幕在线精品 | 97人妻AV天天澡夜夜爽 | 日本最新在线不卡免费视频 | 国产成+人欧美+综合在线观看 | 玩高中女同桌肉色短丝袜脚文 | 美女被黑人巨大进入 | 男人舔女人的阴部黄色骚虎视频 | 精品国产5g影院天天爽 |