Java Code Examples for javax.swing.JTable#setShowHorizontalLines()

The following examples show how to use javax.swing.JTable#setShowHorizontalLines() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSFConfigurationPanelVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initJsfComponentTableVisualProperties(JTable table) {
    table.setRowSelectionAllowed(true);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    table.setTableHeader(null);

    table.setRowHeight(jsfComponentsTable.getRowHeight() + 4);
    table.setIntercellSpacing(new java.awt.Dimension(0, 0));
    // set the color of the table's JViewport
    table.getParent().setBackground(table.getBackground());
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);

    table.getColumnModel().getColumn(0).setMaxWidth(30);
    if (!panel.isMaven()) {
        table.getColumnModel().getColumn(2).setMaxWidth(100);
    }

}
 
Example 2
Source File: TableUtils.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public static void setupTable(JTable table, int selectionModel, TableModel model, MouseListener mouseListener,
                              int... colWidth) {
  table.setFillsViewportHeight(true);
  table.setFont(StyleConstants.FONT_MONOSPACE_LARGE);
  table.setRowHeight(StyleConstants.TABLE_ROW_HEIGHT_DEFAULT);
  table.setShowHorizontalLines(true);
  table.setShowVerticalLines(false);
  table.setGridColor(Color.lightGray);
  table.getColumnModel().setColumnMargin(StyleConstants.TABLE_COLUMN_MARGIN_DEFAULT);
  table.setRowMargin(StyleConstants.TABLE_ROW_MARGIN_DEFAULT);
  table.setSelectionMode(selectionModel);
  if (model != null) {
    table.setModel(model);
  } else {
    table.setModel(new DefaultTableModel());
  }
  if (mouseListener != null) {
    table.removeMouseListener(mouseListener);
    table.addMouseListener(mouseListener);
  }
  for (int i = 0; i < colWidth.length; i++) {
    table.getColumnModel().getColumn(i).setMinWidth(colWidth[i]);
    table.getColumnModel().getColumn(i).setMaxWidth(colWidth[i]);
  }
}
 
Example 3
Source File: JSTestDriverCustomizerPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initTableVisualProperties(JTable table) {
    table.setRowSelectionAllowed(true);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setTableHeader(null);
    table.setRowHeight(jBrowsersTable.getRowHeight() + 4);        
    table.setIntercellSpacing(new java.awt.Dimension(0, 0));        
    // set the color of the table's JViewport
    table.getParent().setBackground(table.getBackground());
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.getColumnModel().getColumn(0).setMaxWidth(30);
}
 
Example 4
Source File: CustomizerLibraries.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initTableVisualProperties(JTable table) {
    //table.setGridColor(jTableCpC.getBackground());
    table.setRowHeight(jTableCpC.getRowHeight() + 4);        
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);        
    table.setIntercellSpacing(new java.awt.Dimension(0, 0));        
    // set the color of the table's JViewport
    table.getParent().setBackground(table.getBackground());
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    
    TableColumn column = table.getColumnModel().getColumn(1);
    JTableHeader header = table.getTableHeader();
    column.setMaxWidth(24 + SwingUtilities.computeStringWidth(header.getFontMetrics(header.getFont()), String.valueOf(column.getHeaderValue())));
    header.setReorderingAllowed(false);
}
 
Example 5
Source File: DrawGridLinesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void checkTableGridLines() {

        TableModel dataModel = new AbstractTableModel() {
            public int getColumnCount() {
                return 10;
            }

            public int getRowCount() {
                return 10;
            }

            public Object getValueAt(int row, int col) {
                return " ";
            }
        };

        DefaultTableCellRenderer r = new DefaultTableCellRenderer();
        r.setOpaque(true);
        r.setBackground(CELL_RENDERER_BACKGROUND_COLOR);

        JTable table = new JTable(dataModel);
        table.setSize(WIDTH, HEIGHT);
        table.setDefaultRenderer(Object.class, r);
        table.setGridColor(GRID_COLOR);
        table.setShowGrid(true);
        table.setShowHorizontalLines(true);
        table.setShowVerticalLines(true);
        table.setBackground(TABLE_BACKGROUND_COLOR);

        checkTableGridLines(table);
    }
 
Example 6
Source File: DrawGridLInesTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkTableGridLines() {

        TableModel dataModel = new AbstractTableModel() {
            public int getColumnCount() {
                return 10;
            }

            public int getRowCount() {
                return 10;
            }

            public Object getValueAt(int row, int col) {
                return " ";
            }
        };

        DefaultTableCellRenderer r = new DefaultTableCellRenderer();
        r.setOpaque(true);
        r.setBackground(CELL_RENDERER_BACKGROUND_COLOR);

        JTable table = new JTable(dataModel);
        table.setSize(WIDTH, HEIGHT);
        table.setDefaultRenderer(Object.class, r);
        table.setGridColor(GRID_COLOR);
        table.setShowGrid(true);
        table.setShowHorizontalLines(true);
        table.setShowVerticalLines(true);
        table.setBackground(TABLE_BACKGROUND_COLOR);

        checkTableGridLines(table);
    }
 
Example 7
Source File: ImportForm.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    createUIComponents();
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(7, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.add(userAccountPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("ImportForm.SelectTeamProject"));
    contentPanel.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    teamProjectFilter = new JTextField();
    contentPanel.add(teamProjectFilter, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    teamProjectScrollPane = new JScrollPane();
    contentPanel.add(teamProjectScrollPane, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    teamProjectTable = new JTable();
    teamProjectTable.setFillsViewportHeight(true);
    teamProjectTable.setShowHorizontalLines(false);
    teamProjectTable.setShowVerticalLines(false);
    teamProjectScrollPane.setViewportView(teamProjectTable);
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("ImportForm.NewRepositoryName"));
    contentPanel.add(label2, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    repositoryName = new JTextField();
    contentPanel.add(repositoryName, new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    refreshButton.setText("");
    refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("ImportDialog.RefreshButton.ToolTip"));
    contentPanel.add(refreshButton, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    busySpinner = new BusySpinnerPanel();
    contentPanel.add(busySpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    helpPanel = new HelpPanel();
    helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.helpText"));
    helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.Instructions"));
    contentPanel.add(helpPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
}
 
Example 8
Source File: PhpFrameworksPanelVisual.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    frameworksScrollPane = new JScrollPane();
    frameworksTable = new JTable();
    descriptionLabel = new JLabel();
    separator = new JSeparator();
    configPanel = new JPanel();

    setFocusTraversalPolicy(null);

    frameworksTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    frameworksTable.setShowHorizontalLines(false);
    frameworksTable.setShowVerticalLines(false);
    frameworksTable.setTableHeader(null);
    frameworksScrollPane.setViewportView(frameworksTable);
    frameworksTable.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksTable.AccessibleContext.accessibleName")); // NOI18N
    frameworksTable.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksTable.AccessibleContext.accessibleDescription")); // NOI18N

    descriptionLabel.setText("DUMMY"); // NOI18N

    configPanel.setLayout(new BorderLayout());

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addComponent(separator, GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
        .addGroup(layout.createSequentialGroup()
            .addComponent(descriptionLabel)
            .addContainerGap())
        .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
        .addComponent(frameworksScrollPane, GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(frameworksScrollPane, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(separator, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(descriptionLabel)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))
    );

    frameworksScrollPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksScrollPane.AccessibleContext.accessibleName")); // NOI18N
    frameworksScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksScrollPane.AccessibleContext.accessibleDescription")); // NOI18N
    descriptionLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.descriptionLabel.AccessibleContext.accessibleName")); // NOI18N
    configPanel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.configPanel.AccessibleContext.accessibleName")); // NOI18N
    configPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.configPanel.AccessibleContext.accessibleDescription")); // NOI18N

    getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.AccessibleContext.accessibleName")); // NOI18N
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.AccessibleContext.accessibleDescription")); // NOI18N
}
 
Example 9
Source File: CheckoutForm.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    createUIComponents();
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(10, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setName("");
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.SelectRepository"));
    contentPanel.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    repositoryFilter = new JTextField();
    repositoryFilter.setName("");
    contentPanel.add(repositoryFilter, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.ParentDirectory"));
    contentPanel.add(label2, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label3 = new JLabel();
    this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.DirectoryName"));
    contentPanel.add(label3, new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    directoryName = new JTextField();
    directoryName.setName("");
    contentPanel.add(directoryName, new GridConstraints(8, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    contentPanel.add(userAccountPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    repositoryTableScrollPane = new JScrollPane();
    contentPanel.add(repositoryTableScrollPane, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    repositoryTable = new JTable();
    repositoryTable.setFillsViewportHeight(true);
    repositoryTable.setName("");
    repositoryTable.setShowHorizontalLines(false);
    repositoryTable.setShowVerticalLines(false);
    repositoryTableScrollPane.setViewportView(repositoryTable);
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory, new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    helpPanel = new HelpPanel();
    helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.helpText"));
    helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.Instructions"));
    contentPanel.add(helpPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    advancedCheckBox = new JCheckBox();
    advancedCheckBox.setText("example text");
    contentPanel.add(advancedCheckBox, new GridConstraints(9, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    busySpinner = new BusySpinnerPanel();
    contentPanel.add(busySpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CheckoutDialog.RefreshButton.ToolTip"));
    contentPanel.add(refreshButton, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
 
Example 10
Source File: PropriedadesSistema.java    From JCEditor with GNU General Public License v2.0 4 votes vote down vote up
/**
* O construtor se encarrega de exibir todo o diálogo
* O método getProperty(), da classe System foi utilizado para obter as informações do sistema
*/
public PropriedadesSistema() {
	setTitle("Sobre este Computador");
	
	tabela = new JTable();
	tabela.setEnabled(false);
	tabela.setShowHorizontalLines(false);
	tabela.setShowVerticalLines(false);
	tabela.setBackground(new Color(238, 238, 238));

	label = new JLabel("Informações");
	label.setFont(new Font("Roboto Light", Font.PLAIN, 28));

	tabela.setModel(new DefaultTableModel(
		new Object[][] {
			{"Sistema Operacional", System.getProperty("os.name") + " " + System.getProperty("os.version")},
			{"Arquitetura", System.getProperty("os.arch")},
			{"Usuário", System.getProperty("user.name")},
			{"Idioma", loc.getDisplayLanguage()},
			{"Versão do Java", System.getProperty("java.version")},
			{"Pasta de instalação do Java", System.getProperty("java.home")},
			{"Class Path", System.getProperty("java.class.path")},

		},
		new String[] {null, null}
		));

	tabela.setBorder(BorderFactory.createTitledBorder(
		null, null,
		TitledBorder.DEFAULT_JUSTIFICATION,
		TitledBorder.DEFAULT_POSITION,
		new Font("Roboto Light", 1, 14)
		));

	this.addKeyListener(new KeyAdapter() {
		public void keyPressed(KeyEvent ev) {
			if (ev.getKeyCode() == KeyEvent.VK_ESCAPE) {
				PropriedadesSistema.this.dispose();
			}
		}
	});

	this.getContentPane().add(BorderLayout.NORTH, label);
	this.getContentPane().add(BorderLayout.CENTER, tabela);
	this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
	this.setResizable(false);
	this.setSize(397, 175);//145
	this.setLocationRelativeTo(null);
	this.setModal(true);
	this.setVisible(true);
}
 
Example 11
Source File: GanttChart.java    From swift-k with Apache License 2.0 4 votes vote down vote up
public GanttChart(SystemState state) {
    this.state = state;
	scale = INITIAL_SCALE;
	jobs = new ArrayList<Job>();
	jobmap = new HashMap<String, Job>();

	header = new JTable() {
		public Dimension getPreferredSize() {
			Dimension d = super.getPreferredSize();
			return new Dimension(50, d.height);
		}
	};
	header.setModel(hmodel = new HeaderModel());
	header.setShowHorizontalLines(true);
	header.setPreferredScrollableViewportSize(new Dimension(100, 10));
	header.setDefaultRenderer(Job.class, new JobNameRenderer());

	table = new JTable();
	table.setDoubleBuffered(true);
	table.setModel(cmodel = new ChartModel());
	table.setShowHorizontalLines(true);
	table.setDefaultRenderer(Job.class, new JobRenderer());
	JPanel jp = new JPanel();
	jp.setLayout(new BorderLayout());
	jp.add(table, BorderLayout.CENTER);

	csp = new JScrollPane(jp);
	csp.setColumnHeaderView(new Tickmarks());
	csp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	csp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	csp.setRowHeaderView(header);
	csp.getVerticalScrollBar().getModel().addChangeListener(this);
	
	hsb = new JScrollBar(JScrollBar.HORIZONTAL);
	hsb.setVisible(true);
	hsb.getModel().addChangeListener(this);

	setLayout(new BorderLayout());
	add(csp, BorderLayout.CENTER);
	add(createTools(), BorderLayout.NORTH);
	add(hsb, BorderLayout.SOUTH);
	
	state.schedule(new TimerTask() {
           @Override
           public void run() {
               GanttChart.this.actionPerformed(null);
           }
	}, 1000, 1000);
}