aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to Maximize and minimize JButton on Mouse over Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to Maximize and minimize JButton on Mouse over" Watch "How to Maximize and minimize JButton on Mouse over" New topic
Author

How to Maximize and minimize JButton on Mouse over

Arjun Palanichamy
Ranch Hand

Joined: Jul 15, 2006
Posts: 51
Hi All...

I am herewith enclosed my sample code for resize the JButton(),But This one resize the when will be extend the Button Caption letters,But i want mouse click resize the without button caption or with caption.

sample code :

package Resize;

import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;

import java.awt.Dimension;
import java.awt.ComponentOrientation;

public class ReButton{
public static boolean RIGHT_TO_LEFT = false;

public static void addComponents(Container contentPane) {
if (RIGHT_TO_LEFT) {
contentPane.setComponentOrientation(
ComponentOrientation.RIGHT_TO_LEFT);
}
contentPane.setLayout(new FlowLayout());

contentPane.add(new JButton("1"));
contentPane.add(new JButton("100"));
contentPane.add(new JButton("100 100"));
contentPane.add(new JButton("100 100 100"));
contentPane.add(new JButton("100 100 100 100"));
contentPane.add(new JButton("5"));

}


private static void createAndShowGUI() {

JFrame frame = new JFrame("FlowLayoutDemo") {
public Dimension getMinimumSize() {
Dimension prefSize = getPreferredSize();
return new Dimension(100, prefSize.height);
}
};
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Set up the content pane.
addComponents(frame.getContentPane());

//Display the window.
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {

javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}

************************

Thanks for your time.

Arjun Palanichamy.
Chennai-India.
[ August 19, 2006: Message edited by: Arjun Palanichamy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Maximize and minimize JButton on Mouse over
 
Similar Threads
please help .. please
GridBagLayout Problem
How to handle events in java
in flow lay out how can i force to add component on next line?
How to make Resize JButton() on mouse click...