public class JF_AppIniConfigurator extends javax.swing.JFrame
{
private JD_AddConfig m_AddConfig = new JD_AddConfig(this,true);
public JF_AppIniConfigurator()
{
initComponents();
initComponentsExtra();
}
private void initComponentsExtra()
{
this.setTitle("AdminTool");
this.setSize(550, 450);
this.validate();
AppGlobals.putInSchema("GUI", "Frame", this);
}
public void initData()
{
logoGevas();
zentriertePosition();
refresh();
}
//Firmenlogo wird eingfügt
private void logoGevas()
{
jl_logo.setIcon(new ImageIcon("D:\\Projekte\\IHK\\AdminTool\\logo\\logo.JPG"));
jl_logo.validate();
jl_logo.repaint();
}
//zentriert den Frame
private void zentriertePosition()
{
int screen_w = Toolkit.getDefaultToolkit().getScreenSize().width;
int screen_h = Toolkit.getDefaultToolkit().getScreenSize().height;
int frame_w = this.getWidth();
int frame_h = this.getHeight();
int x = (screen_w - frame_w)/2;
int y = (screen_h - frame_h)/2;
setLocation(x,y);
}
/**
* Füllt die Liste der GUI
*/
private void addListFileName()
{
DefaultListModel m_listModel = new DefaultListModel();
jList.setModel(m_listModel);
ArrayList<IniFile> iniFileList = IniConfigController.getInstance().loadIniFiles();
if(iniFileList.size()==0)
{
JOptionPane.showMessageDialog(this, "Liste ist leer, da keine IniFiles vorhanden sind", "Leere Liste", JOptionPane.INFORMATION_MESSAGE);
}
else
{
for(int i=0;i< iniFileList.size();i++)
{
IniFile iniFile = iniFileList.get(i);
m_listModel.addElement(iniFile);
}
}
}
public void refresh()
{
addListFileName();
}
private void saveList()
{
ArrayList<IniFile> iniFileList = new ArrayList<IniFile>();
DefaultListModel listModel = (DefaultListModel)jList.getModel();
for(int i=0; i<listModel.size(); i++)
{
IniFile file = (IniFile)listModel.getElementAt(i);
String pfad = file.getPfad();
String name = file.getName();
iniFileList.add(new IniFile(name,pfad));
}
IniConfigController.getInstance().setIniFile(iniFileList);
}
public void getklick()
{
jList.addMouseListener(new MouseAdapter()
{
public void mouseReleased(MouseEvent evt)
{
if (evt.isPopupTrigger())
{
showMenu(evt);
}
}
});
}
public void showMenu(MouseEvent evt)
{
JPopupMenu jKontext = new JPopupMenu();
JMenuItem jInfo = new JMenuItem(jList.getSelectedValue().toString());
jInfo.addActionListener(..........?);
jKontext.add(jInfo);
jKontext.show(jList, evt.getX(), evt.getY());
}