Note that there are some explanatory texts on larger screens.

plurals
  1. POI am trying to divide a window into portions with panels, but they all resize to one huge frame
    primarykey
    data
    text
    <pre><code>import Sprites.*; import javax.swing.*; import java.awt.*; public class Main { public int Health = 100; public int ArmourPt = 0; public int Gold = 250; public static JLabel Goldlbl = new JLabel("Gold:"); public static JLabel Healthlbl = new JLabel("Health:"); public static JLabel ArmourPtLbl = new JLabel("Armour Points"); public static JFrame MainWindow = new JFrame(); public static int CalcDamage(int Damage, int Armour){ int ReturnDamage = Damage - Armour + Damage / Damage + Armour / Damage * Damage - Armour + Damage + 25 ; if(ReturnDamage &lt; 0){ ReturnDamage = 0; } return ReturnDamage; } public static void main(String[] args) { // TODO Auto-generated method stub MainWindow.setSize(1500, 700); MainWindow.setTitle("Ampventure");; JPanel MPanel = (JPanel)MainWindow.getContentPane(); JPanel StatsPanel = new JPanel(); StatsPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 4)); StatsPanel.setSize(350, 450); StatsPanel.setLocation(0, 0); StatsPanel.setMaximumSize(new Dimension (350, 450)); MPanel.add(StatsPanel); JPanel InvPanel = new JPanel(); InvPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 4)); InvPanel.setSize(350, 250); InvPanel.setLocation(0, 450); StatsPanel.setMaximumSize(new Dimension (350, 250)); MPanel.add(InvPanel); MainWindow.setVisible(true); } } </code></pre> <p>When executed this is SUPPOSED to make two panels off to the side and with different sizes adding up to the total Y and 350 X. Instead it just makes them all the same size and just makes a border around the window.</p> <p>How do i get it to do this? </p> <p>(EDIT) I have fixed the typo. and only the Stats Panel does what it's supposed to do. ALSO I don't want to use a layout manager. I want to set and size everything myself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload