Ankith Reddy has Published 1070 Articles

How to set TabLayout Policy to JTabbedPane in Java when all the tabs does not fit in a single run

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

260 Views

To set TabLayout Policy to JTabbedPane in Java when all the tabs does not fit in a single run, use the method setTabLayoutPolicy() −JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);Above we have set the constant to be SCROLL_TAB_LAYOUT, which is a tab layout policy for providing a subset of available tabs ... Read More

Make the JSlider vertical and move top-to-bottom in Java

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

178 Views

To set the JSlider to be vertical, use the VERTICAL constant while creating the slider −JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 60);Now, for the inverted slider i.e. moving from top-to-bottom −slider.setInverted(true);The following is an example to set the slider vertical and move top-to-bottom −Examplepackage my; import javax.swing.JFrame; import javax.swing.JPanel; ... Read More

HTML DOM Anchor hreflang Property

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

61 Views

The HTML DOM Anchor hreflang property is used to set or return the value of the hreflang attribute of a link.Following is the syntax to set the hreflang property −anchorObj.hreflang = language_codeAbove, language_code represents the language of the linked document. This language code examples, include en for English, bn for ... Read More

How can I set scrollbars to never appear in Java?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

57 Views

To set scrollbars to never appear, use the JScrollPane.HORIZONTAL_SCROLLBAR_NEVER and JScrollPane.VERTICAL_SCROLLBAR_NEVER. Let’s say you created a Box with some button components. Now, create a JScrollPane:JScrollPane scrollPane = new JScrollPane();Set the Viewport view as Box:scrollPane.setViewportView(box);Now, set the scrollbars to never appear:scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);The following is an example to set scrollbars to never ... Read More

HTML width Attribute

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

109 Views

The width attribute of the element is used to set the width of the canvas in pixels. Following is the syntax −Above, pixels_val is the width set in pixels. Let us now see an example to implement the width attribute of the element −Example Live Demo ... Read More

How to limit text length of EditText in Android?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

4K+ Views

This example demonstrate about How to limit text length of EditText in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step ... Read More

How to display a pdf document into an Android Webview?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

2K+ Views

This example demonstrate about How to lock the Android device programmatically.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml     Step 3 − ... Read More

How to check Android Phone Model programmatically?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

1K+ Views

This example demonstrate about How to check Android Phone Model programmatically.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − ... Read More

How to get current foreground activity context in Android?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

5K+ Views

This example demonstrate about How to get current foreground activity context in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to src/MyApp.javapackage app.tutorialspoint.com.sample ; import android.app.Activity ... Read More

How can I validate EditText input in Android?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:26

781 Views

This example demonstrate about How can I validate EditText input in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.java     Step 3 ... Read More

Advertisements