Select Git revision
LibraryPanel.java
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
LibraryPanel.java 1.90 KiB
package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.border.EtchedBorder;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface;
@SuppressWarnings("serial")
public class LibraryPanel extends ComfortPanel {
//SYMBOLIC LINKS
private LibraryPanel self = this;
private LibStatusPanel libStatusPanel;
private JButton searchLibButton;
private JLabel yoshikoVersionLabel;
public LibraryPanel() {
this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
//SWING COMPONENT INITIALIZATION
libStatusPanel = new LibStatusPanel();
searchLibButton = new JButton(LocalizationManager.get("resolveLibPath"));
yoshikoVersionLabel = new JLabel(LocalizationManager.get("yoshVersion"));
libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded());
if (YoshikoLoader.isLibraryLoaded()) {
yoshikoVersionLabel.setText(LibraryInterface.getVersionString());
searchLibButton.setEnabled(false);
}
searchLibButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final YLibChooser c = new YLibChooser();
int returnVal = c.showOpenDialog(self);
if (returnVal == JFileChooser.APPROVE_OPTION) {
YoshikoLoader.loadLibrary(c.getSelectedFile().getAbsolutePath());
}
libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded());
yoshikoVersionLabel.setText(LibraryInterface.getVersionString());
searchLibButton.setEnabled(false);
}
});
this.addAll(libStatusPanel,yoshikoVersionLabel,searchLibButton);
//Decoration/Visual
this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
}
}