3个回答
展开全部
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.Rectangle;
public class HideButton extends JFrame {
private JPanel jPanel = null;
private JButton jButton = null;
/**
* This method initializes
*
*/
public HideButton() {
super();
initialize();
}
/**
* This method initializes this
*
*/
private void initialize() {
this.setSize(new Dimension(239, 129));
this.setContentPane(getJPanel());
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.add(getJButton(), null);
}
return jPanel;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(72, 29, 109, 39));
jButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent e) {
jButton.setVisible(false);
}
public void mouseExited(java.awt.event.MouseEvent e) {
jButton.setVisible(true);
}
});
}
return jButton;
}
public static void main(String args[]){
new HideButton().setVisible(true);
}
}
import java.awt.Dimension;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.Rectangle;
public class HideButton extends JFrame {
private JPanel jPanel = null;
private JButton jButton = null;
/**
* This method initializes
*
*/
public HideButton() {
super();
initialize();
}
/**
* This method initializes this
*
*/
private void initialize() {
this.setSize(new Dimension(239, 129));
this.setContentPane(getJPanel());
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.add(getJButton(), null);
}
return jPanel;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(72, 29, 109, 39));
jButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent e) {
jButton.setVisible(false);
}
public void mouseExited(java.awt.event.MouseEvent e) {
jButton.setVisible(true);
}
});
}
return jButton;
}
public static void main(String args[]){
new HideButton().setVisible(true);
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是swing吗?组件一般都有setToolTipText方法的,可以实现鼠标悬停提示
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
最简单的就是设置td的title
或者用div做,这个比较复杂一点,但是效果比较好,源码到处都有
或者用div做,这个比较复杂一点,但是效果比较好,源码到处都有
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询