initial attempt at WindowBuilder
This commit is contained in:
		
							parent
							
								
									74a8bf211c
								
							
						
					
					
						commit
						11d73758d3
					
				
					 1 changed files with 56 additions and 0 deletions
				
			
		
							
								
								
									
										56
									
								
								WindowBuilder/GUI.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								WindowBuilder/GUI.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,56 @@ | ||||||
|  | // * this code was generated by Window Builder extension * // | ||||||
|  | 
 | ||||||
|  | import javax.swing.*; | ||||||
|  | import java.awt.*; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public class GUI { | ||||||
|  |   public static void main(String[] args) { | ||||||
|  |     JFrame frame = new JFrame("Primary Window"); | ||||||
|  |     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||||||
|  |     frame.setSize(400, 400); | ||||||
|  |      | ||||||
|  |     JPanel panel = new JPanel(new GridBagLayout()); | ||||||
|  |     GridBagConstraints constraints = new GridBagConstraints(); | ||||||
|  | 
 | ||||||
|  |     // Fill the layout with placeholders | ||||||
|  |     for (int row = 0; row < 12; row++) { | ||||||
|  |         for (int col = 0; col < 12; col++) { | ||||||
|  |             constraints.gridx = col; | ||||||
|  |             constraints.gridy = row; | ||||||
|  |             constraints.weightx = 1.0; | ||||||
|  |             constraints.weighty = 1.0; | ||||||
|  |             constraints.fill = GridBagConstraints.BOTH; | ||||||
|  | 
 | ||||||
|  |             Component filler = Box.createRigidArea(new Dimension(0, 0)); | ||||||
|  |             panel.add(filler, constraints); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     constraints.weightx = 0; | ||||||
|  |     constraints.weighty = 0; | ||||||
|  |     constraints.fill = GridBagConstraints.NONE; | ||||||
|  |     constraints.anchor = GridBagConstraints.NORTHWEST; | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  |     JLabel label_0 = new JLabel("If you see this window, then it is successful. "); | ||||||
|  |     constraints.gridx = 1; | ||||||
|  |     constraints.gridy = 2; | ||||||
|  |     constraints.gridwidth = 1; | ||||||
|  |     constraints.gridheight = 1; | ||||||
|  |     panel.add(label_0, constraints); | ||||||
|  |      | ||||||
|  |     JButton button_0 = new JButton("Thank you"); | ||||||
|  |     button_0.setPreferredSize(new Dimension(98, 47)); | ||||||
|  |      | ||||||
|  |     constraints.gridx = 8; | ||||||
|  |     constraints.gridy = 9; | ||||||
|  |     constraints.gridwidth = 2; | ||||||
|  |     constraints.gridheight = 2; | ||||||
|  |     panel.add(button_0, constraints); | ||||||
|  |      | ||||||
|  |     frame.add(panel); | ||||||
|  |     frame.setVisible(true); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |      | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue