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 9010415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:27:08+00:00 2026-06-16T02:27:08+00:00

I’m doing a project but I have a little problem with a Frame, I

  • 0

I’m doing a project but I have a little problem with a Frame, I have a problem with a table.

Well, I have this:

My frame

The source that have for the previous picture is:

public class Geotools04 extends JFrame {
private JMapFrame mapFrame;
static StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
static FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);

Geotools04(File[] files) throws IOException, CQLException {


        FileDataStore store = FileDataStoreFinder.getDataStore(files[0]);
        SimpleFeatureSource featureSource = store.getFeatureSource();

        Filter filter = CQL.toFilter("MAN_COD = '01'");
        SimpleFeatureCollection features = featureSource.getFeatures(filter);
        FeatureCollectionTableModel model = new FeatureCollectionTableModel(features);


        for(int i=0;i<model.getColumnCount();i++){
            System.out.println(model.getColumnName(i));
        }

        JFrame frame = new JFrame();


        JTable table = new JTable();

        frame.setLayout(new GridLayout(6, 2)) ;

        JLabel a = new JLabel("Capas existentes:");

        JComboBox layer = new JComboBox();
        for(int i=0; i < files.length ; i++){
            layer.addItem(files[i].getName());    
        }

        JLabel c = new JLabel("Atributos de capa:");

        JComboBox d = new JComboBox();
        d.addItem ("MAN_COD");

        JCheckBox e = new JCheckBox("Where");
        JTextField f = new JTextField("= '01'");
        JCheckBox g = new JCheckBox("Where igual");

        JTextField h = new JTextField("01");
        h.setEditable(false);

        JCheckBox i = new JCheckBox("Todos los registros");
        JButton j = new JButton("Consultar");

        frame.add(a);
        frame.add(layer);
        frame.add(c);
        frame.add(d);
        frame.add(e);
        frame.add(f);
        frame.add(g);
        frame.add(h);
        frame.add(i);
        frame.add(j);

        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setModel(new DefaultTableModel(5, 5));
        table.setPreferredScrollableViewportSize(new Dimension(500, 200));
        JScrollPane scrollPane = new JScrollPane(table);
        table.setModel(model);
        frame.add(scrollPane);

        frame.setSize(600, 600);
        frame.setVisible(true);
}
}

But I need that my frame look like this:

my goal

So, can you help me, I put all in a GridLayout but I need that the last table
be bigger… But I don’t know how to organize the element for put in the way that
I want to…

  • 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-16T02:27:09+00:00Added an answer on June 16, 2026 at 2:27 am

    Try like this:

    1. Instead of adding components directly on JFrame create separate JPanel and add all components except JScrollPane (which contains JTable) and “Salir” button.

    2. Set BorderLayout for your JFrame.

    3. Set GridLayout for that JPanel add components and add that JPanel to NORTH of JFrame.

      frame.add(panel, BorderLayout.NORTH);
      
    4. Add JScrollPane to CENTER of your JFrame

      frame.add(scrollPane, BorderLayout.CENTER);
      
    5. You can add your “Salir” button directly to SOUTH of frame or you can create one more JPanel add “Salir” button to that JPanel and finally add JPanel to SOUTH of frame:

      frame.add(salir, BorderLayout.SOUTH);
      

      or

      JPanel salirPanel = new JPanel();
      salirPanel.setLayout(new FlowLayout(FlowLayout.RIGHT,3,3));
      salirPanel.add(salirButton);
      frame.add(salirPanel);
      

    P.S. Don’t forget to call frame.pack(); instead of frame.setSize(); before calling frame.setVisible(); method!

    EDIT

    Consider using some other layout for your upper components, like GridBagLayout
    or MiG Layout instead of GridLayout.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I know there's a lot of other questions out there that deal with 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.