本文整理汇总了Java中javax.swing.JTextArea.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Java JTextArea.addMouseListener方法的具体用法?Java JTextArea.addMouseListener怎么用?Java JTextArea.addMouseListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextArea
的用法示例。
在下文中一共展示了JTextArea.addMouseListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImagePicker
import javax.swing.JTextArea; //导入方法依赖的package包/类
public ImagePicker() {
noImage = new JTextArea(1,10);
noImage.setFont(FONT);
noImage.setText("Double-click here to add new image");
noImage.addMouseListener(this);
noImage.setEditable(false);
noImage.setLineWrap(true);
noImage.setWrapStyleWord(true);
noImage.setMinimumSize(new Dimension(15, 32));
icon = new OpIcon();
imageView = new JLabel(icon);
imageView.addMouseListener(this);
imageViewer = new JPanel(new BorderLayout());
imageScroller = new ScrollPane(
imageView,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
imageViewer.add(imageScroller, BorderLayout.CENTER);
select = new JComboBox(ArrayUtils.prepend(GameModule.getGameModule().getDataArchive().getImageNames(), NO_IMAGE));
select.addItemListener(this);
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
add(noImage);
add(select);
}
示例2: initAndShowUI
import javax.swing.JTextArea; //导入方法依赖的package包/类
private static void initAndShowUI() {
frame = new JFrame("Test frame");
frame.setSize(SIZE, SIZE);
frame.setLocationRelativeTo(null);
final JTextArea jta = new JTextArea();
jta.setBackground(Color.RED);
frame.add(jta);
jta.setText("1234567890");
jta.setFont(jta.getFont().deriveFont(150f));
jta.setDragEnabled(true);
jta.selectAll();
jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY,
new TestdropTargetListener()));
jta.addMouseListener(new TestMouseAdapter());
frame.setVisible(true);
}
示例3: TextNotification
import javax.swing.JTextArea; //导入方法依赖的package包/类
public TextNotification() {
m_fromLabel = new JLabel();
m_titleLabel = new JLabel();
m_titleLabel.addMouseListener(new NotificationMouseAdapter(m_titleLabel));
m_subtitleArea = new JTextArea();
m_subtitleArea.addMouseListener(new NotificationMouseAdapter(m_titleLabel));
JPanel panelHeader = new JPanel();
panelHeader.setLayout(new BoxLayout(panelHeader, BoxLayout.PAGE_AXIS));
JButton dimissButton = new JButton();
dimissButton.setText("X");
final TextNotification me = this;
dimissButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
me.removeFromManager();
}
});
dimissButton.setOpaque(false);
dimissButton.setContentAreaFilled(false);
dimissButton.setBorderPainted(false);
dimissButton.setBounds((int) (this.getWidth() - dimissButton.getPreferredSize().getWidth()), 0, (int) dimissButton.getPreferredSize().getWidth(), (int) dimissButton.getPreferredSize().getHeight());
m_panel.add(dimissButton);
panelHeader.add(m_fromLabel);
panelHeader.add(m_titleLabel);
this.addComponent(panelHeader, BorderLayout.NORTH);
this.addComponent(m_subtitleArea, BorderLayout.CENTER);
}
示例4: install
import javax.swing.JTextArea; //导入方法依赖的package包/类
public void install(JTextArea textArea) {
textArea.addCaretListener(this);
textArea.addComponentListener(this);
textArea.addFocusListener(this);
textArea.addKeyListener(this);
textArea.addMouseListener(this);
textArea.addMouseMotionListener(this);
}
示例5: setListener
import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
* set up the listener for the text area editor open the full size editor on
* right click
*
* @param jTextArea - target text area control
*/
private void setListener(final JTextArea jTextArea) {
jTextArea.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
panelTextArea.setText(jTextArea.getText());
temp = jTextArea;
showNext();
panelTextArea.requestFocus();
}
}
});
jTextArea.setToolTipText("Press Right click to edit in Full Mode");
}
示例6: init
import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
*
* @Title: init
* @Description: Component Initialization
* @param
* @return void
* @throws
*/
private void init()
{
this.setLayout(new BorderLayout(FormatConst.BORDER_WIDTH, 0));
txtAra = new JTextArea(FormatConst.AREA_ROWS, 1);
txtAra.addMouseListener(ma);
miFmt = new JMenuItem(FormatConst.FORMAT);
miFmt.setName(FormatConst.FORMAT);
miFmt.addActionListener(this);
miCut = new JMenuItem(FormatConst.CUT);
miCut.setName(FormatConst.CUT);
miCut.addActionListener(this);
miCpy = new JMenuItem(FormatConst.COPY);
miCpy.setName(FormatConst.COPY);
miCpy.addActionListener(this);
miClr = new JMenuItem(FormatConst.CLEAR);
miClr.setName(FormatConst.CLEAR);
miClr.addActionListener(this);
miPst = new JMenuItem(FormatConst.PASTE);
miPst.setName(FormatConst.PASTE);
miPst.addActionListener(this);
pm = new JPopupMenu();
pm.add(miFmt);
pm.addSeparator();
pm.add(miCut);
pm.add(miCpy);
pm.add(miPst);
pm.addSeparator();
pm.add(miClr);
JPanel pnlCenter = new JPanel();
pnlCenter.setLayout(new BorderLayout());
JScrollPane sp = new JScrollPane(txtAra);
pnlCenter.add(sp);
this.add(pnlCenter, BorderLayout.CENTER);
}