. , - , , , , .
, .
, radai, , . , , ( , ).
import java.awt.Frame;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.JDialog;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
public class Test {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
init();
}
});
}
public static void init() {
final int staticHeight = 150;
final JDialog dialog = new JDialog((Frame) null) {
@Override
protected JRootPane createRootPane() {
JRootPane rp = new JRootPane() {
@Override
public void reshape(int x, int y, int w, int h) {
super.reshape(x, y, w, staticHeight);
}
};
rp.setOpaque(true);
return rp;
}
@Override
public void reshape(int x, int y, int width, int height) {
super.reshape(x, y, width, staticHeight);
}
};
dialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
dialog.setSize(dialog.getWidth(), staticHeight);
}
});
dialog.pack();
dialog.setVisible(true);
}
}