Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9201799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:06:21+00:00 2026-06-17T23:06:21+00:00

I am using this JTable method to create a Cell with a JComboBox as

  • 0

I am using this JTable method to create a Cell with a JComboBox as their rendered appearance.

public void addComboBoxToColumn(String[] options, int column_index){
    ComboTableCellRenderer renderer = new ComboTableCellRenderer();
    JComboBox<String> combo = new JComboBox<String>(options);
    TableCellEditor combo_editor  = new DefaultCellEditor(combo);
    TableColumn column = getColumnModel().getColumn(column_index);
    column.setCellRenderer(renderer);
    column.setCellEditor(combo_editor);     
}

…

public class ComboTableCellRenderer implements ListCellRenderer, TableCellRenderer 
{
    DefaultListCellRenderer listRenderer = new DefaultListCellRenderer();
    DefaultTableCellRenderer tableRenderer = new DefaultTableCellRenderer();

    private void configureRenderer(JLabel renderer, Object value)
    {
        if (value != null)
            renderer.setText((String)value);
    }

    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
    {
        listRenderer = (DefaultListCellRenderer)listRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        configureRenderer(listRenderer, value);
        return listRenderer;
    }

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    {
        tableRenderer = (DefaultTableCellRenderer)tableRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        configureRenderer(tableRenderer, value);
        return tableRenderer;
    }

}

My problem is that the combobox is always the size of the cell. I do not want that. Is it possible to make the combo box bigger? Some options in the combobox are too big and are half-hidden.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:06:22+00:00Added an answer on June 17, 2026 at 11:06 pm

    My problem is that the combobox is always the size of the cell. I do
    not want that. Is it possible to make the combo box bigger? Some
    options in the combobox are too big and are half-hidden.

    • not possible without jumping of cell Dimmension on the Screen, don’t to confuse the user

    • to avoiding possible side effects, I’d be

    • create popup undecorated JDialog (for editable JComboBox), JWindow, put there JComboBox

    • add ListSelectionListener (have to change ListSelectionMode to SINGLE)

    • change built in KeyBinding in JTable for TableCellEditor (double_click or F2) to showing JDialog/JWindow have to center to the desired Point on the scren, setVisible must be wrapped in invokeLater

    • add ItemListener, test for SELECTED, on selected to store value to (setValueAt()) XxxTableModel, then to hide JDialog/JWindow

    • use only one JDialog (reuse by removeAll from content pane for another action from GUI) for whole JVM instance, only one for JTable

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my jTable private JTable getJTable() { String[] colName = { Name, Email,
I am using 2 Tables (JTable) with their DefaultTableModels. The first table is already
I tried to do a search system using java swing : public void search(ActionEvent
There is a common method when using JTable TableCellRenderers for setting the background and
Often when using JTable or JTree , user define its own cell renderer. It
I'm using this example: www.jtable.org I've downloaded the jTable PHP version. I then edited
i want to add all my data from DB to jtable, but using this
In my UI I am using a JTable with a TableModel.In a update method
I am wanting to use a JTable but with a different cell selection method
I want to create a simple table using the JTable wherein the values will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.