In java GUI , shall we make a package of creating a link ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In java GUI , shall we make a package of creating a link ?

for eg. import java.swing.CreateLink;

9th Oct 2018, 3:57 PM
Bipin Tatkare
Bipin Tatkare - avatar
10 Answers
+ 1
please elaborate.
13th Oct 2018, 1:42 PM
Tanay
Tanay - avatar
+ 3
No. I suggest keep the inbuild pakage default as it is if you really need to make pakage then create in separate file but not in the standard package.
13th Oct 2018, 2:21 PM
Tanay
Tanay - avatar
+ 2
I think you misunderstood the concept of packages and classes here in import java.util.Scanner ; util is the package name and Scanner is the class and we create the Object of class Scanner like wise swing is package too and if you want to create class named CreateLink you can just create package and put that class into the package and then import it just like package Link; class CreateLink{ //your code goes here } -------------------------------------- then import Link.CreateLink; CreateLink cL = new CreateLink();
13th Oct 2018, 2:13 PM
Tanay
Tanay - avatar
+ 2
apparently not but if you can make it to Jpanel and then add both into the one JFrame.
13th Oct 2018, 2:28 PM
Tanay
Tanay - avatar
+ 2
JFrame one = new JFrame(); JFrame two = new JFrame(); for Merging Jpanel one = new JPanel(); Jpanel two = new JPanel(); Box merged = Box.createVerticalBox(); merged.add(one); merged.add(two); JFrame newFrame = new JFrame(); newFrame.add(merged); newFrame.setVisible(true);
13th Oct 2018, 2:41 PM
Tanay
Tanay - avatar
+ 1
Let's take an example : the package :- import java.util.Scanner; In this package , we will make an object of accepting the input . for eg. Scanner accept = new Scanner(System.in); like that , I am thinking that , if we make an object of Createlink as ; Createlink obj = new Createlink(); and we can attach the link by predefined method as ; obj.Link(new URL:"https://www.google.com"); Its just an example . I will think that if we make this package then ..............
13th Oct 2018, 1:58 PM
Bipin Tatkare
Bipin Tatkare - avatar
+ 1
what I am asking sir ? if this package will make inbuilt in java then ..? shall we make an inbuilt package for java like this or not ?
13th Oct 2018, 2:18 PM
Bipin Tatkare
Bipin Tatkare - avatar
+ 1
Thank you for your suggestion sir ! but I have one more doubt ?
13th Oct 2018, 2:24 PM
Bipin Tatkare
Bipin Tatkare - avatar
+ 1
happy to help
13th Oct 2018, 2:25 PM
Tanay
Tanay - avatar
+ 1
can we merge two frames in one using swing ? with their different functions ?
13th Oct 2018, 2:26 PM
Bipin Tatkare
Bipin Tatkare - avatar