Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Java will not recognize GridBAgConstraints()

$
0
0
The following code will not work, because Java will not recognize GridBagConstraints(), even though I have imported both java .awt.*;
and java.awt.GridBagConstraints; :helpsmilie:/>
here is the code:
import java.awt.GridBagConstraints;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.lang.*;
public class PRG421 extends JFrame{
    String[] stuff = {"Footwear", "Jewelery", "Electronics", 
        "Housewares", "Bathroom"}; 
    //Set department choices for drop-down combobox menu
    JComboBox box = new JComboBox(stuff);  //create and populate combobox
    double pryc;
    double prcnt;
    double reduct = prcnt / 100;     
    double salpryc = pryc - reduct;
    private JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints const = new GridBagConstraints();// SAYING this is invalid method declaration?? 

I am at my wits end with this now, and I have a project that is due tomorrow!! :censored:/>/>/>/>
I need to arrange items within my GUI, and wanted to use GridBagLayout to do so, but Java won't allow it for some reason.... :crazy:/>/>/>/>
Can someone PLEASE tell me what is wrong here, because I have seen this done a million times, and all that was needed was to import java.awt.*; and it worked fine, but for some reason it has decided to be difficult tonight and I cannot see what is wrong here?? :?:/>/>/>/>

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>