package org.openslx.dozmod.gui.activity; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import org.openslx.dozmod.gui.control.QLabel; import org.openslx.dozmod.util.OpenLinks; import org.openslx.dozmod.util.OpenLinks.Link; public class UpdatePanel extends ActivityPanel implements ActionListener { protected JPanel header; protected JLabel lblInfo; protected final JButton btnLink; protected final JButton btnClose; @Override public boolean wantConfirmQuit() { return false; } public UpdatePanel(final String newVersion) { super(); setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); // Header: Neue Version verfügbar: [Button] header = new JPanel(); header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS)); lblInfo = new QLabel("Neue Version verfügbar: " + newVersion); header.add(lblInfo); header.add(Box.createHorizontalGlue()); btnLink = new JButton("Im Browser öffnen"); btnClose = new JButton("Schließen"); btnLink.addActionListener(this); btnClose.addActionListener(this); header.add(btnLink); header.add(btnClose); add(header); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnLink) { OpenLinks.openWebpage(Link.DOZMOD); close(); } if (e.getSource() == btnClose) { close(); } } }