Create Top-Bottom Split Pane in Java

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

340 Views

To create a top-bottom split pane, let us create two components and split them −JComponent one = new JLabel("Top Split"); one.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); JComponent two = new JLabel("Bottom Split"); two.setBorder(BorderFactory.createLineBorder(Color.ORANGE));Now, we will split them. The two components will be split one on top of the other using VERTICAL_PANE constant −JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, one, two);The following is an example to create a top-bottom split pane in Java −Examplepackage my; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JSplitPane; public class SwingDemo {    public static void main(String[] a) {       JFrame frame = new JFrame("SplitPane Demo"); ... Read More

Is NAME a Reserved Word in MySQL?

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

398 Views

No, name is not a reserved word in MySQL, you can use without backtick symbol. If you are working on a reserved word then use backtick symbol. Let us first create a table −mysql> create table name    (    name varchar(10)    ); Query OK, 0 rows affected (0.78 sec)Now you can insert some records in the table using insert command −mysql> insert into name values('John'); Query OK, 1 row affected (0.13 sec) mysql> insert into name values('Carol'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select *from name;Output+-------+ | name ... Read More

Modify Properties of a Nested Object in JavaScript

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

3K+ Views

There are two methods to modify properties of nested objects. One is Dot method and the other is Bracket method. The functionality is same for both the methods, but the only difference is their notation. lets' discuss them in detail.Dot methodExampleIn the following example initially the value of property country is England. But using Dot notation the value is changed to India.Live Demo    var person;    var txt = '';    person = {       "name":"Ram",       "age":27,       "address": {          "houseno":123,          "streetname":"Baker street",     ... Read More

Auto Increment in MySQL Can Be Signed by Default

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

348 Views

Yes, the AUTO_INCREMENT in MySQL will be signed (Positive and Negative Value both) by default.Let us first create a table −mysql> create table DemoTable    -> (    -> MyNumber int AUTO_INCREMENT PRIMARY KEY    -> ); Query OK, 0 rows affected (0.45 sec)Insert some records in the table using insert command. Here, we have set negative values as well for AUTO_INCREMENT column −mysql> insert into DemoTable values() ; Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(-100); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(-300); Query OK, 1 row affected ... Read More

C++ Program for Smallest K-Digit Number Divisible by X

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

271 Views

In this problem we will try to find smallest K-digit number, that will be divisible by X. To do this task we will take the smallest K digit number by this formula (10^(k-1)). Then check whether the number is divisible by X or not, if not, we will get the exact number by using this formula.(min+ 𝑋)−((min+ 𝑋) 𝑚𝑜𝑑 𝑋)One example is like a 5-digit number, that is divisible by 29. So the smallest 5-digit number is 10000. This is not divisible by 29. Now by applying the formula we will get −(10000+ 29)−((10000+29) 𝑚𝑜𝑑 29)=10029−24=10005The number 10005 is divisible ... Read More

HTML DOM Legend Form Property

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

130 Views

The HTML DOM Legend form property returns the reference of enclosing form for Legend tag.SyntaxFollowing is the syntax −Returning reference to the form objectlegendObject.formExampleLet us see an example for Legend form property − Live Demo Legend form    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Legend-form Examination Week:    var divDisplay = document.getElementById("divDisplay");    var legendForm = document.getElementById("legendForm");    function showExamination() {       divDisplay.textContent = 'Examinations: '+legendForm.form.id;    } OutputThis will produce the following output −Before clicking ‘What exams are in this week?’ button −After checking ‘What exams are in this week?’ button −

Join String Stream in Java

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

599 Views

Let us create string Stream:Stream stream = Stream.of("Bing Bang Theory", "Vampire Diaries", "Game of Thrones", "Homecoming");Convert the above string stream and join them with Collectors:final String str = stream.collect(Collectors.joining(" "));The following is an example to convert string Stream to join them:Exampleimport java.util.stream.Collectors; import java.util.stream.Stream; public class Demo {    public static void main(String[] args) {       Stream stream = Stream.of("Bing Bang Theory", "Vampire Diaries", "Game of Thrones", "Homecoming");       final String str = stream.collect(Collectors.joining(" "));       System.out.println("Join result..."+str);    } }OutputJoin result... Bing Bang Theory Vampire Diaries Game of Thrones HomecomingRead More

JDialog Modality Type Application Modal Explained

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

330 Views

The JDialog Modality type APPLICATION_MODAL blocks all top-level windows and it has restrictions. The following is an example to set JDialog with Modality type APPLICATION_MODAL:Exampleimport java.awt.Cursor; import java.awt.Dialog.ModalityType; import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       frame.setSize(new Dimension(600, 400));       JDialog dialog = new JDialog(frame, "New", ModalityType.APPLICATION_MODAL);       dialog.setSize(300, 300);       frame.add(new JButton(new AbstractAction("Click to generate") {          @Override          public void ... Read More

Start Activity When User Clicks Notification in Android

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

426 Views

This example demonstrate about How to start an activity when user clicks a notification 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 res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity {   ... Read More

What is Proxy Class in C++

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

2K+ Views

Here we will see what is the proxy class in C++. The Proxy class is basically the Proxy design pattern. In this pattern an object provides a modified interface for another class. Let us see one example.In this example, we want to make an array class, that can store only binary values [0, 1]. This is the first try.Example Codeclass BinArray {    int arr[10];    int & operator[](int i) {       //Put some code here    } };In this code, there is no condition checking. But we want the operator[] to complain if we put something like ... Read More

Advertisements