George John has Published 1167 Articles

HTML

George John

George John

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

210 Views

The form attribute of the element is used to specify the forms wherein the button belongs to.Following is the syntax −The id above is the if of the form wherein the button belongs to.Let us now see an example to implement the form attribute of the element−Example Live Demo ... Read More

How can I separate Menu Items in a Menu with Java?

George John

George John

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

249 Views

Let’s say we have following MenuBar and menu in it -JMenuBar menuBar = new JMenuBar(); UIManager.put("MenuBar.background", Color.ORANGE); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu);Now, we will create a MenuItem and separate it using the JSeparator():JMenuItem menuItem1 = new JMenuItem("New", KeyEvent.VK_N); fileMenu.add(menuItem1); // separating MenuItems fileMenu.add(new JSeparator());The following is an example ... Read More

Implementing Web Scraping in Python with BeautifulSoup?

George John

George John

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

204 Views

BeautifulSoup is a class in the bs4 module of python. Basic purpose of building beautifulsoup is to parse HTML or XML documents.Installing bs4 (in-short beautifulsoup)It is easy to install beautifulsoup on using pip module. Just run the below command on your command shell.pip install bs4Running above command on your terminal, ... Read More

HTML min Attribute

George John

George John

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

97 Views

The min attribute of the element is used to set the minimum value for . Both min and max are used to set a range of value for input element with type number, date, datetime, range, etc. It introduced in HTML5.Let us now see an example to implement the ... Read More

Set whether the row in the table model can be selected or deselected in Java?

George John

George John

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

332 Views

We can set or disallow selection of row in the table using setRowSelectionAllowed().Let’s say the following is our table −DefaultTableModel tableModel = new DefaultTableModel(); JTable table = new JTable(tableModel);If you want to allow selection of row, then set the method to TRUE −table.setRowSelectionAllowed(true);If you want to disallow selection of row, ... Read More

Java Program to display only vertical grid lines in a JTable

George John

George John

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

132 Views

At first, set the setShowGrid() to FALSE to disable all the grid lines. To display only vertical grid lines in a table, set the method setShowVerticalLines() to TRUE. Let us first create a table with rows and columns −String[][] rec = {    { "1", "Steve", "AUS" },    { ... Read More

Display all the titles of JTabbedPane tabs on Console in Java

George John

George John

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

300 Views

To display all the titles of the JTabbedPane, let us first get the count of tabs −int count = tabbedPane.getTabCount();Now, loop through the number of tabs in the JTabbedPane. Use the getTitleAt() to get the title of each and every tab −for (int i = 0; i < count; i++) ... Read More

How to set magins between cells of a JTable in Java?

George John

George John

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

412 Views

To set the margins i.e. row and columns margins between cells of a table, use the setIntercellSpacing() method −Dimension dim = new Dimension(50, 2); table.setIntercellSpacing(new Dimension(dim));Above, we have used the Dimension class −The following is an example to set margins between cells of a JTable cell −Examplepackage my; import java.awt.Dimension; ... Read More

How to retrieve the value from a table cell with TableModel in Java?

George John

George John

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

658 Views

At first, create a table with DefaultTableModel −String data[][] = {    {"Australia", "5", "1"},    {"US", "10", "2"},    {"Canada", "9", "3"},    {"India", "7", "4"},    {"Poland", "2", "5"},    {"SriLanka", "5", "6"} }; String col [] = {"Team", "Selected Players", "Rank"}; DefaultTableModel tableModel = new DefaultTableModel(data, col); ... Read More

How to disable a Tab in a JTabbedPane Container with Java?

George John

George John

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

2K+ Views

To disable a tab in a JTabbedPane container, use the setEnabledAt() method and set it to false with the index of the tab you want to disable.Let’s first create a JTabbedPane −JTabbedPane tabbedPane = new JTabbedPane();Now, let us disable a tab at index 2 −tabbedPane.setEnabledAt(2, false);The following is an example ... Read More

Advertisements