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

  • Home
  • SEARCH
  • 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 8835493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:16:24+00:00 2026-06-14T09:16:24+00:00

I have created a customized editor for my table by extending default editor in

  • 0

I have created a customized editor for my table by extending default editor in java. The code look like

import java.awt.Component;
import java.text.ChoiceFormat;

import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JTable;

import com.ushustech.nmsazzist.model.mib.MibVariableModel;


public class MibFormattedValueEditor extends DefaultCellEditor
{

private JComboBox m_comboBox;
public MibFormattedValueEditor()
{
    this(new JComboBox());
}

public MibFormattedValueEditor(JComboBox comboBox)
{
    super(comboBox);
    this.m_comboBox = comboBox;
}

@Override
public Object getCellEditorValue()
{
    return this.m_comboBox.getSelectedItem();
}

@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
{
    this.m_comboBox.removeAllItems();
    MibVariableModel model = (MibVariableModel) table.getModel();
    ChoiceFormat format = model.getMibVariable(row).getFormat();

    if(null != format){
        Object[] obj = format.getFormats();
        for(int i=0;i<obj.length;i++){
            this.m_comboBox.addItem(obj[i].toString());
        }

    }

    return super.getTableCellEditorComponent(table, value, isSelected, row, column);

}

}  

I want to display a text field editor if the format is null ? Please Help me for doing this? Thanks.

  • 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-14T09:16:25+00:00Added an answer on June 14, 2026 at 9:16 am

    I wouldn’t replace the ComboBox as this can get dirty. I would rather set it editable in case of format == null and let the user input the information here. Like this:

    if(null != format) {
       // ...
    } else {
       this.m_comboBox.setEditable(true);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a customized BasicEditField with Border using Bitmap.Now while typing the text,it
i have created customized analytic code for my clients. It tracks visits and conversions.
I have created my own customized lots of architecture including n-tier layers for different
I have created a customized call that is called in UITableViewCell (cellForRowAtIndexPath) . Everything
I have a rather complicated (and customized) Entity Framework entity class library created, and
I have a model like this: class Item(models.Model): code = models.CharField(max_length=200, unique=True) barcode =
I have created customized menu and toolbar in MS Excel. I wanted to show
I have created customized combobox which extends JCombobox. It is having checkboxes in popup
I have created a customized System Service, and i want my service to capture
I have created a Flex custom preloader, exactly like it is done in this

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.