Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.1 kB
2
Indexable
Never
// Code adding the component to the parent container - not shown here
JLabel titleLabel = new javax.swing.JLabel();

titleLabel.setText("jLabel1");
titleLabel.setText(musical.getName());
musicalPanel.add(titleLabel);

musicalPanel.add(Box.createRigidArea(new Dimension(0, 10)));

JLabel descriptionLabel = new javax.swing.JLabel();

descriptionLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

descriptionLabel.setText("jLabel2");

descriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);

// Create a JLabel with text wrapping using HTML formatting
descriptionLabel.setText("<html>"+musical.getDescription()+"<html>");

musicalPanel.add(descriptionLabel);

musicalPanel.add(Box.createRigidArea(new Dimension(0, 10)));

ImagePanel img = new ImagePanel(musical.getName());
img.loadImageAsync(musical.getImageURL());
img.setSize(130, 170);
img.setPreferredSize(new Dimension(130,170));
img.setMaximumSize(new Dimension(130,170));
img.setMinimumSize(new Dimension(130,170));
img.setAlignmentX(Component.LEFT_ALIGNMENT);
musicalPanel.add(img);
Leave a Comment