Example usage for javax.swing JTable AUTO_RESIZE_OFF

List of usage examples for javax.swing JTable AUTO_RESIZE_OFF

Introduction

In this page you can find the example usage for javax.swing JTable AUTO_RESIZE_OFF.

Prototype

int AUTO_RESIZE_OFF

To view the source code for javax.swing JTable AUTO_RESIZE_OFF.

Click Source Link

Document

Do not adjust column widths automatically; use a horizontal scrollbar instead.

Usage

From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetSwing.CFInternetSwingISOTimezoneFinderJPanel.java

public CFInternetSwingISOTimezoneFinderJPanel(ICFInternetSwingSchema argSchema) {
    super();//from  w  w w .  j  a v a  2s  .  c om
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingClusterListJPanel.java

public CFAsteriskSwingClusterListJPanel(ICFAsteriskSwingSchema argSchema, ICFLibAnyObj argContainer,
        ICFSecurityClusterObj argFocus, Collection<ICFSecurityClusterObj> argDataCollection,
        ICFJRefreshCallback refreshCallback, boolean sortByChain) {
    super();//from  www  . j  a v  a  2  s  . c o m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    swingRefreshCallback = refreshCallback;
    swingSortByChain = sortByChain;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    // Do initial layout
    setSize(1024, 480);
    JMenuBar menuBar = getPanelMenuBar();
    add(menuBar);
    menuBar.setBounds(0, 0, 1024, 25);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 25, 1024, 455);
    adjustListMenuBar();
    doLayout();
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingISOTimezoneFinderJPanel.java

public CFAsteriskSwingISOTimezoneFinderJPanel(ICFAsteriskSwingSchema argSchema) {
    super();//from   ww w . j a va  2s. co  m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractTable.java

protected void adjustColumnHeaders() {
    List<TableColumn> notInited = new LinkedList<>();
    int summaryWidth = 0;
    int componentWidth = impl.getParent().getWidth();

    // take into account only visible columns
    Enumeration<TableColumn> columnEnumeration = impl.getColumnModel().getColumns();
    while (columnEnumeration.hasMoreElements()) {
        TableColumn tableColumn = columnEnumeration.nextElement();
        Column column = (Column) tableColumn.getIdentifier();

        Integer width = column.getWidth();
        if (width != null) {
            tableColumn.setPreferredWidth(width);
            tableColumn.setWidth(width);
            summaryWidth += width;/*  w  w  w  .  j a v  a2s . co m*/
        } else {
            notInited.add(tableColumn);
        }
    }

    if (notInited.size() != impl.getColumnCount()) {
        impl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

        if (!notInited.isEmpty() && (componentWidth > summaryWidth)) {
            int defaultWidth = (componentWidth - summaryWidth) / notInited.size();
            for (TableColumn column : notInited) {
                column.setPreferredWidth(Math.max(defaultWidth, column.getWidth()));
            }
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchSwing.CFFreeSwitchSwingISOTimezoneFinderJPanel.java

public CFFreeSwitchSwingISOTimezoneFinderJPanel(ICFFreeSwitchSwingSchema argSchema) {
    super();//from w ww.  j  av  a  2s  .  c  om
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSecUserFinderJPanel.java

public CFAsteriskSwingSecUserFinderJPanel(ICFAsteriskSwingSchema argSchema) {
    super();//from  w w w  . java2 s . com
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswSwing.CFFswSwingSecSessionPickerJPanel.java

public CFFswSwingSecSessionPickerJPanel(ICFFswSwingSchema argSchema, ICFFswSecSessionObj argFocus,
        ICFFswSecUserObj argContainer, Collection<ICFFswSecSessionObj> argDataCollection,
        ICFFswSwingSecSessionChosen whenChosen) {
    super();/*  w w w .j  a  va 2  s . c  o  m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedSecSession();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsSecSession(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingISOTimezoneFinderJPanel.java

public CFAccSwingISOTimezoneFinderJPanel(ICFAccSwingSchema argSchema) {
    super();/*www. j  ava2 s. co m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingISOTimezoneFinderJPanel.java

public CFAstSwingISOTimezoneFinderJPanel(ICFAstSwingSchema argSchema) {
    super();// w w  w  .  j a v a2s. co m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingISOCurrencyPickerJPanel.java

public CFAsteriskSwingISOCurrencyPickerJPanel(ICFAsteriskSwingSchema argSchema,
        ICFSecurityISOCurrencyObj argFocus, ICFLibAnyObj argContainer,
        Collection<ICFSecurityISOCurrencyObj> argDataCollection, ICFAsteriskSwingISOCurrencyChosen whenChosen) {
    super();//from  ww w  . j a v  a 2s  . com
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedISOCurrency();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsISOCurrency(argFocus);
}