0

I have a lot of lines of code that are similar to this:

objectListPanel = new javax.swing.JPanel();
roomNameField = new javax.swing.JTextField();
rightPanel = new javax.swing.JPanel();
jTabbedPane = new javax.swing.JTabbedPane();
enterScriptPanel = new javax.swing.JPanel();

in that they all use the "Fully Qualified Name" for a class. Is there a way to quickly fix all of these to just use the class name?

objectListPanel = new JPanel();
roomNameField = new JTextField();
rightPanel = new JPanel();
jTabbedPane = new JTabbedPane();
enterScriptPanel = new JPanel();
Kyranstar
  • 1,650
  • 2
  • 14
  • 35
  • If there are multiple files with different import then replace all fully qualified values using regex them manually import it using shortcuts. – Braj Jul 11 '14 at 21:08
  • Someone forget to leave the comment when it's down voted. – Braj Jul 11 '14 at 21:16

2 Answers2

1

Find new javax.swing. and replace with new and then import it in the class.

Use Ctrl + Shift + O keyboard shortcuts to organize imports automatically.

read more...

Community
  • 1
  • 1
Braj
  • 46,415
  • 5
  • 60
  • 76
1

can you use an import? try placing the below line at the top of your java file.

import javax.swing.*;
Andreas
  • 4,937
  • 2
  • 25
  • 35
  • @Braj I'd agree in the case of an IDE, though if you do CL java, it becomes a lifesaver sometimes. – Rogue Jul 11 '14 at 21:04
  • he says he has "a lot of lines". My cut off before a wildcard import is about 15. Eclipse's organize imports merges to a wildcard at 99. – Andreas Jul 11 '14 at 21:04