Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AboutDialog extends JDialog implements ActionListener {
- public AboutDialog(Frame parent, String title, boolean modal) {
- super(parent, title, modal);
- setSize(500, 400);
- setLocationRelativeTo(parent);
- setLayout(new BorderLayout());
- JPanel panBot = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- JButton btnOk = new JButton("OK");
- btnOk.addActionListener(this);
- getRootPane().setDefaultButton(btnOk);
- panBot.setBackground(Color.WHITE);
- panBot.add(btnOk);
- add(panBot, BorderLayout.SOUTH);
- JPanel panTop = new JPanel();
- panTop.setPreferredSize(new Dimension(100,30));
- panTop.setBackground(Color.WHITE);
- panTop.add(new JLabel(Config.getTitle() + " - O Autoru"));
- add(panTop,BorderLayout.NORTH);
- JPanel panLeft=new JPanel(new BorderLayout());
- panLeft.setPreferredSize(new Dimension(180,200));
- ImagePanel imgAutor = new ImagePanel(new ImageIcon("img/autor2.jpg").getImage());
- panLeft.add(imgAutor);
- add(panLeft,BorderLayout.WEST);
- JPanel panCenter = new JPanel(new BorderLayout());
- JSeparator sep = new JSeparator();
- sep.setOrientation(SwingConstants.VERTICAL);
- panCenter.setPreferredSize(new Dimension(10,400));
- panCenter.add(sep);
- add(panCenter,BorderLayout.CENTER);
- Dimension lblDimension = new Dimension(200,20);
- Box boxRight = new Box(BoxLayout.Y_AXIS);
- boxRight.setPreferredSize(new Dimension(300,400));
- JPanel panDetails1 = new JPanel();
- // panDetails1.add(Box.createGlue());
- // panDetails1.add(boxRight.createVerticalStrut(100));
- JLabel lblImePrz = new JLabel();
- lblImePrz.setPreferredSize(lblDimension);
- lblImePrz.setText("Ime i Prezime: Goran Todorovic");
- panDetails1.add(lblImePrz);
- JLabel lblBrInd = new JLabel();
- lblBrInd.setPreferredSize(lblDimension);
- lblBrInd.setText("Broj Indeksa: RA 170/2011");
- panDetails1.add(lblBrInd);
- JLabel lblEmail = new JLabel();
- lblEmail.setPreferredSize(lblDimension);
- panDetails1.add(lblEmail);
- JLabel lblHobi = new JLabel();
- lblHobi.setPreferredSize(lblDimension);
- lblHobi.setText("Hobi: Sakupljanje salveta.");
- panDetails1.add(lblHobi);
- JSeparator sep1 = new JSeparator();
- sep1.setOrientation(SwingConstants.HORIZONTAL);
- sep1.setPreferredSize(new Dimension(300,5));
- panDetails1.add(sep1);
- JLabel lblVerzija = new JLabel();
- lblVerzija.setPreferredSize(new Dimension(280, 20));
- lblVerzija.setText("Copyright \u00a9 2013 Goran Todorovic :: verzija: 0.1b");
- panDetails1.add(lblVerzija);
- boxRight.add(panDetails1);
- add(boxRight, BorderLayout.EAST);
- }
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals("OK"))
- setVisible(false);
- }
- }
- @SuppressWarnings("serial")
- class ImagePanel extends JPanel {
- private Image img;
- public ImagePanel(String img) {
- this(new ImageIcon(img).getImage());
- }
- public ImagePanel(Image img) {
- this.img = img;
- }
- public void paintComponent(Graphics g) {
- g.drawImage(img, (int)(this.getSize().getWidth()-img.getWidth(null))/2,
- (int)(this.getSize().getHeight()-img.getHeight(null))/2, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement