1

I am trying to import a bunch of java related API's into my android project but when I import them it says it cannot find the package

here is an example of what I an trying to import

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

all the javax.swing classes show an error. When I go into where the java JDK was installed and look at the src.zip file I see all those classes in there so what do I do to get them to work?

tyczj
  • 71,600
  • 54
  • 194
  • 296

2 Answers2

0

Here's what I found after a quick search on the interwebs:

Swing

How do I add the javax.swing.* packages to my libs for my android project?

Synapsis: You can't use swing in your android project

AWT

Using awt with android

Synapsis: You can't use the awt library directly, but you can make your own implementation of it, or use the one linked to here.

Community
  • 1
  • 1
Kris Selbekk
  • 7,438
  • 7
  • 46
  • 73
0

I do no think that you can include java.swing packages in an Android app. I would suggest you take a look at the User Interface building blocks that Android provides. Here is a StackOverflow thread that has a similar discussion about not being able to add java.swing packages.

Community
  • 1
  • 1
sathishpaul
  • 112
  • 8