📄 htmltoolbar1.java
字号:
package com.cwq.batchmail.htmltoolbar;
import java.awt.ComponentOrientation;
import java.awt.GridBagLayout;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.io.File;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.text.MutableAttributeSet;
public class HtmlToolbar1 extends JPanel {
private static final long serialVersionUID = 1L;
private HtmlToolBar app;
/**
* This is the default constructor
*/
public HtmlToolbar1(HtmlToolBar app) {
super();
this.app = app;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
this.setLayout(null);
this.setBounds(new Rectangle(12, 6, 625, 22));
this.setBorder(null);
this.setBackground(app.color1);
this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
JLabel jl1 = new ImageButton("b.gif", null, "b_1.gif") {
public void mouseClicked(MouseEvent arg0) {
app.insertTag("<strong>", "</strong>");
}
};
jl1.setLocation(0, 1);
this.add(jl1);
JLabel jl2 = new ImageButton("i.gif", null, "i_1.gif") {
public void mouseClicked(MouseEvent arg0) {
app.insertTag("<em>", "</em>");
}
};
jl2.setLocation(jl2.getWidth() - 2, 1);
this.add(jl2);
JLabel jl3 = new ImageLabel("split.gif");
jl3.setLocation(jl2.getLocation().x + jl2.getWidth() - 2, 0);
this.add(jl3);
JLabel jl4 = new ImageButton("link.gif", null, "link_1.gif") {
public void mouseClicked(MouseEvent arg0) {
String link = javax.swing.JOptionPane.showInputDialog(app, "������t�请输入链接的网址");
if(link == null || (link != null && link.trim().length() == 0))
return ;
app.insertTag("<a href='" + link + "'>", "</a>");
}
};
jl4.setLocation(jl3.getLocation().x + jl3.getWidth() - 2, 1);
this.add(jl4);
JLabel jl5 = new ImageLabel("split.gif");
jl5.setLocation(jl4.getLocation().x + jl4.getWidth() - 2, 0);
this.add(jl5);
JLabel jl6 = new ImageButton("ink.gif", null, "ink_1.gif") {
public void mouseClicked(MouseEvent arg0) {
app.insertTag("<blockquote>", "</blockquote>");
}
};
jl6.setLocation(jl5.getLocation().x + jl5.getWidth() - 2, 1);
this.add(jl6);
JLabel jl7 = new ImageLabel("split.gif");
jl7.setLocation(jl6.getLocation().x + jl6.getWidth() - 2, 0);
this.add(jl7);
JLabel jl8 = new ImageButton("abc.gif", null, "abc_1.gif") {
public void mouseClicked(MouseEvent arg0) {
//app.abcDocument();
}
};
jl8.setLocation(jl7.getLocation().x + jl7.getWidth() - 2, 1);
this.add(jl8);
JLabel jl9 = new ImageLabel("split.gif");
jl9.setLocation(jl8.getLocation().x + jl8.getWidth() - 2, 0);
this.add(jl9);
JLabel jl10 = new ImageButton("pic.gif", null, "pic_1.gif") {
public void mouseClicked(MouseEvent arg0) {
//app.getPictureUpload().setVisible(true);
String img = javax.swing.JOptionPane.showInputDialog(app, "请输入图片的网址");
if(img == null || (img != null && img.trim().length() == 0))
return ;
app.insertTag("<img src='" + img + "'>", "");
}
};
jl10.setLocation(jl9.getLocation().x + jl9.getWidth() - 2, 1);
this.add(jl10);
JLabel jl11 = new ImageLabel("split.gif");
jl11.setLocation(jl10.getLocation().x + jl10.getWidth() - 2, 0);
this.add(jl11);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -