Skip to content

Instantly share code, notes, and snippets.

@dahool
Created March 1, 2023 19:01
Show Gist options
  • Select an option

  • Save dahool/d07d8b637ac8c1cfead1e301a0d2a5e9 to your computer and use it in GitHub Desktop.

Select an option

Save dahool/d07d8b637ac8c1cfead1e301a0d2a5e9 to your computer and use it in GitHub Desktop.

Revisions

  1. dahool renamed this gist Mar 1, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. dahool created this gist Mar 1, 2023.
    39 changes: 39 additions & 0 deletions panel
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    public class MyPanel extends JPanel {
    private JLabel jcomp1;
    private JLabel jcomp2;
    private JLabel statusPrinter;
    private JLabel statusPinpad;

    public MyPanel() {
    //construct components
    jcomp1 = new JLabel ("Impresora");
    jcomp2 = new JLabel ("PinPad");
    statusPrinter = new JLabel ("-");
    statusPinpad = new JLabel ("-");

    //adjust size and set layout
    setPreferredSize (new Dimension (262, 94));
    setLayout (null);

    //add components
    add (jcomp1);
    add (jcomp2);
    add (statusPrinter);
    add (statusPinpad);

    //set component bounds (only needed by Absolute Positioning)
    jcomp1.setBounds (10, 20, 70, 25);
    jcomp2.setBounds (10, 55, 75, 25);
    statusPrinter.setBounds (85, 20, 165, 25);
    statusPinpad.setBounds (85, 50, 170, 25);
    }


    public static void main (String[] args) {
    JFrame frame = new JFrame ("MyPanel");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add (new MyPanel());
    frame.pack();
    frame.setVisible (true);
    }
    }