Code example for JLabel

Methods: setHorizontalAlignment

	/** The file name of the PDF we're going to label. */ 
	String filename = "";
	/** the label containing the metadata */ 
	JLabel label = new JLabel();
	/** the scrollpane to scroll through the label */ 
	JScrollPane scrollpane = new JScrollPane();
	/** the panel to witch the scrollpane will be added. */ 
	JPanel panel = new JPanel();
	/** Construct the information label (actually it's a JPanel). */ 
	public PdfInformationPanel() { 
		try { 
			this.setLayout(new BorderLayout());
			panel.setLayout(new BorderLayout());
			this.add(panel, BorderLayout.CENTER);
			scrollpane.setPreferredSize(new Dimension(200, 200));
			panel.add(scrollpane, BorderLayout.CENTER);
Contextual code suggestions in your IDE  Get Codota for Java