Re: JFrame resizing



On May 28, 9:34 pm, Stephan Lukits <stephan.luk...@xxxxxxxxxxxxxxxx>
wrote:
...
(I actually want to make sure, that the frams' size dosen't
  go below a specific size).

<sscce>
import javax.swing.*;
import java.awt.*;

class MinimumSizeFrame extends JFrame {

public void paint(Graphics g) {
super.paint(g);
g.setColor( Color.BLACK );
g.drawString(
"WxH: " + getWidth() + "x" + getHeight(),
20,
40 );
}

public static void main(String[] args) {
Runnable r = new Runnable() {
public void run() {
JFrame f = new MinimumSizeFrame();
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.setMinimumSize( new Dimension(400,300) );
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
};
EventQueue.invokeLater(r);
}
}
</sscce>

--
Andrew T.
PhySci.org
.



Relevant Pages

  • Re: Text component not focusable (tabbed pane switching involved) try 2: SSCCE
    ... mentions SSCCE in the title. ... new AbstractAction("Add tab") ... public void actionPerformed ... int tc = ctp.getTabCount; ...
    (comp.lang.java.gui)
  • Wait cursor changing to IBar
    ... (I know the SSCCE is supposed to demonstrate the problem. ... public void actionPerformed{ ... This SSCCE sets some text in a text area, changes the cursor to ... SearchCriteria s = getSearchCriteria(dbName, sessionId); ...
    (comp.lang.java.gui)
  • Re: java.lang.OutOfMemoryError: Java heap space
    ... Don't know, how much is that an SSCCE, but I am posting you my example: ... private class ArrElem { ... public void setFp ... int bitM = elem1.getFp.cardinality; ...
    (comp.lang.java.programmer)
  • Re: basic GUI question
    ... My new code, without any callbacks: (this is not SSCCE, it's just an ... public void run{ ... String input = JOptionPane.showInputDialog(dialogParent_, ... public void processCommand(MyCommand cmd, Listargs) { ...
    (comp.lang.java.programmer)