package fvhttpserver;
import java.io.IOException;
import javax.swing.JOptionPane;
public class ImpostazioniDialog
extends javax.
swing.
JDialog {
public ImpostazioniDialog
(java.
awt.
Frame parent
) {
super(parent);
initComponents();
Impostazioni im = Impostazioni.getImpostazioni();
port.setText("" + im.port);
dir.setText(im.basedir);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1
= new javax.
swing.
JLabel();
jLabel2
= new javax.
swing.
JLabel();
jButton1
= new javax.
swing.
JButton();
jButton2
= new javax.
swing.
JButton();
setTitle("FVHTTP Server - Impostazioni");
jLabel1.setText("Server Port:");
jLabel2.setText("Server directory:");
port.setText("80");
jButton1.setText("Annulla");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Salva");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.
addPreferredGap(javax.
swing.
LayoutStyle.
ComponentPlacement.
RELATED, 207,
Short.
MAX_VALUE)
.addComponent(jButton2))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(port, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dir, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE))))
.
addContainerGap(javax.
swing.
GroupLayout.
DEFAULT_SIZE,
Short.
MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(dir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.
addContainerGap(javax.
swing.
GroupLayout.
DEFAULT_SIZE,
Short.
MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed
(java.
awt.
event.
ActionEvent evt
) {//GEN-FIRST:event_jButton2ActionPerformed
try {
Impostazioni.
setImpostazioni(Integer.
parseInt(port.
getText()), dir.
getText());
setVisible(false);
Main.stopServer();
Main.startServer();
try {
dispose();
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed
(java.
awt.
event.
ActionEvent evt
) {//GEN-FIRST:event_jButton1ActionPerformed
dispose();
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.
swing.
JButton jButton1
;
private javax.
swing.
JButton jButton2
;
private javax.
swing.
JLabel jLabel1
;
private javax.
swing.
JLabel jLabel2
;
// End of variables declaration//GEN-END:variables
}