George John has Published 1081 Articles

How to disable close button on a JFrame in Java?

George John

George John

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

986 Views

To disable the close button, let us first create a frame −JFrame frame = new JFrame("Login!");Use the setDefaultCloseOperation() to set the status of the close button. Set it to DO_NOTHING_ON_CLOSE to disable it −frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);The following is an example to disable close button on a JFrame in Java −Examplepackage my; import ... Read More

HTML canvas strokeRect() Method

George John

George John

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

390 Views

The strokeRect() method of the HTML canvas is used to create a rectangle on a web page. The element allows you to draw graphics on a web page using JavaScript. Every canvas has two elements that describes the height and width of the canvas i.e. height and width respectively.Following ... Read More

Remove last char if it's a specific character in MySQL?

George John

George John

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

2K+ Views

To remove last char if it is a specific character then use SUBSTRING(). Let us first create a table −mysql> create table DemoTable    (    SubjectName varchar(100)    ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('MySQL'); ... Read More

How to separate Components in a Row or Column with Box in Java

George John

George John

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

304 Views

To separate components in a row or column, use the createGlue() method. This creates an invisible "glue" component that separates components.The following is an example to separate components in a row or column with Box −Examplepackage my; import java.awt.BorderLayout; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; public ... Read More

HTML
  • value Attribute
  • George John

    George John

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

    253 Views

    The value attribute of the element is used to set the value of the list item. Since the value is a number, it would be set only for the ol element in HTML i.e. the ordered list.Following is the syntax −Above, num is the value of the list item ... Read More

    Resolve Syntax error near “ORDER BY order DESC” in MySQL?

    George John

    George John

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

    3K+ Views

    The word order is a reserved order in MySQL and you have used it in the query. To get rid of the syntax error, you need to use backticks(` `) around the order.The correct syntax is as follows −select *from yourTableName ORDER BY `order` DESC;Let us first create a table ... Read More

    HTML content Attribute

    George John

    George John

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

    386 Views

    The content attribute of the element is used to set the meta information in an HTML document. This can be the information for the description or the keywords, for name attribute.Following is the syntax:Above, the text is the meta information.Let us now see an example to implement the content ... Read More

    How to create a GridLayout with rows and columns in Java?

    George John

    George John

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

    892 Views

    While creating a GridLayout, you need to set the rows and columns as parenthesis. A GridLayout is used to create a layout the specified number of rows and columns.Let’s say we have a GridLayout, with 1 row and 4 columns −GridLayout layout = new GridLayout(1, 4);The following is an example ... Read More

    Customize the JOptionPane layout with updated color and image in Java

    George John

    George John

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

    2K+ Views

    Customize the layout by changing the look and feel of the panel in which you added the component −ImageIcon icon = new ImageIcon(new URL("http −//www.tutorialspoint.com/images/C-PLUS.png")); JLabel label = new JLabel(icon); JPanel panel = new JPanel(new GridBagLayout()); panel.add(label); panel.setOpaque(true); panel.setBackground(Color.ORANGE);Above, we have added an image and even updated the background color ... Read More

    HTML data Attribute
    George John

    George John

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

    119 Views

    Tha data attribute of the element sets the URL of the resource, which can be audio, video, pdf, flash, etc. used by the object.Following is the syntax:The url is the URL of the resource used by the object.Let us now see an example to implement the data attribute of ... Read More

    Advertisements