Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DedisWindow {
- private static JFrame frame;
- private static DefaultTableModel tableModel;
- static {
- initialize();
- }
- private static void initialize() {
- frame = new JFrame("Control de servidores dedicados");
- frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
- frame.setVisible(false);
- JTable table = new JTable();
- table.getTableHeader().setReorderingAllowed(false);
- table.setFillsViewportHeight(true);
- table.setRowSelectionAllowed(false);
- table.setBackground(new Color(204, 204, 153));
- tableModel = new DefaultTableModel() {
- private static final long serialVersionUID = -5177074969522608672L;
- @Override
- public boolean isCellEditable(int row, int column) {
- return false;
- }
- };
- tableModel.addColumn("Servidor");
- tableModel.addColumn("Carga CPU (%)");
- tableModel.addColumn("Memoria usada");
- tableModel.addColumn("Memoria máxima");
- tableModel.addColumn("Espacio libre");
- table.setModel(tableModel);
- table.getColumnModel().getColumn(1).setCellRenderer(new DedisCellRenderer());
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.setViewportView(table);
- GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
- groupLayout.setHorizontalGroup(
- groupLayout.createParallelGroup(Alignment.LEADING)
- .addGroup(groupLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
- .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE))
- .addContainerGap())
- );
- groupLayout.setVerticalGroup(
- groupLayout.createParallelGroup(Alignment.LEADING)
- .addGroup(groupLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)
- .addContainerGap())
- );
- frame.getContentPane().setLayout(groupLayout);
- frame.pack();
- }
- public static void update() {
- // TODO Actualizar
- }
- public static void show() {
- if (frame.isVisible()) {
- return;
- }
- frame.setLocationRelativeTo(null);
- frame.setVisible(!frame.isVisible());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement