Display Large Component Within Smaller Area in Java

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

140 Views

To display a large component in a smaller display area, use JScrollPane, so that it’s easier for user to scroll through the component. The following is an example to display large component within a smaller display area in Java −Examplepackage my; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Demo");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       JButton button1 = new JButton("One");       JButton button2 = new JButton("Two");       JButton button3 = new JButton("Three"); ... Read More

Divide Two 16-Bit Numbers in 8085

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

3K+ Views

Here we will see how to divide two 16 bit numbers using 8085.Problem StatementWrite 8085 Assembly language program to divide two 16-bit numbers.Discussion8085 has no division operation. To perform division, we have to use repetitive subtraction. To perform 16-bit division, we have to do the same but for the register pairs. As the register pairs are used to hold 16-bit data.The Divisor is stored at location FC00 and FC01, the dividend is stored at FC02 and FC03. After division, the quotient will be stored at FC04 and FC05, and the remainder will be stored at FC06 and FC07.InputAddressDataFC008AFC015CFC025AFC031D Flow Diagram ProgramAddressHEX CodesLabelsMnemonicsCommentsF00001, ... Read More

Get Only the Minutes from Datetime in MySQL

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

277 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> ShippingDate datetime    -> ); Query OK,  0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-10 10:04:45'); Query OK,  1 row affected (0.18 sec) mysql> insert into DemoTable values('2019-06-11 05:45:00'); Query OK,  1 row affected (0.23 sec) mysql> insert into DemoTable values('2019-06-12 07:00:55'); Query OK,  1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+---------------------+ | ShippingDate | +---------------------+ | 2019-01-10 10:04:45 | | 2019-06-11 05:45:00 | | 2019-06-12 07:00:55 | +---------------------+ 3 rows in set (0.00 sec)Here is the query to get minutes in MySQL −mysql> select minute(ShippingDate) as Minutes from DemoTable;Output+---------+ | Minutes | +---------+ | 4 ... Read More

HTML DOM Input Week Type Property

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

142 Views

The HTML DOM Input Week type property returns/sets type of Input Week.SyntaxFollowing is the syntax −Returning string valueinputWeekObject.typeSetting type to string valueinputWeekObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsweekIt defines that input type is weekdatetime-localIt defines that input type is datetime-localcheckboxIt defines that input type is checkboxtextIt defines that input type is textExampleLet us see an example for Input Week type property − Live Demo Input Week type    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;   ... Read More

Concatenate Fields in MySQL

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

377 Views

To concatenate fields in MySQL, you can use GROUP_CONCAT() along with GROUP BY. Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(30),    StudentScore int    ); Query OK, 0 rows affected (0.51 sec)Insert records in the table using insert command −mysql> insert into DemoTable( StudentName, StudentScore) values('Bob', 80); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable( StudentName, StudentScore) values('Bob', 80); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable( StudentName, StudentScore) values('Chris', 90); Query OK, 1 row affected (0.13 sec) ... Read More

Apostrophe Replacement in MySQL Query

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

601 Views

To replace apostrophe, you can use replace(). Following is the syntax −update yourTableName set yourColumnName=replace(yourColumnName, '\'', '');Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Sentence varchar(100)    ); Query OK, 0 rows affected (0.17 sec)Insert some records in the table using insert command. Apostrophe is added for the sentence −mysql> insert into DemoTable(Sentence) values('Chris\'s Father'); Query OK, 1 row affected (0.07 sec) mysql> insert into DemoTable(Sentence) values('Larry\'s Mother'); Query OK, 1 row affected (0.06 sec)Display all records from the table using select statement −mysql> select *from ... Read More

Display Only the Horizontal Scrollbar in Java

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

545 Views

To display only the horizontal scrollbar, use the VERTICAL_SCROLLBAR_NEVER constant, which eventually displays only the horizontal scrollbar.The following is an example to display only the horizontal scrollbar in Java −Examplepackage my; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Demo");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       JButton button1 = new JButton("Online Compiler");       JButton button2 = new JButton("Quiz");       JButton button3 = new JButton("Questions and Answers");       JButton button4 = new ... Read More

Find Element That Appears Once in 8085 Program

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

506 Views

In this program we will see how to find a number who appears only once in an array of elements.Problem StatementWrite 8085 Assembly language program to find a number who appears only once in an array of elements. The size of the array is stored at location F100; the numbers are stored from memory location F101 onwards. The result will be stored at F150.DiscussionThe logic behind this problem is simple. Though it may find some wrong results in some cases. It can find the number if there is only one number which is appeared once, and rest of the numbers ... Read More

HTML Canvas shadowOffsetY Property

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

120 Views

The shadowOffsetY property of the HTML canvas is used to set the vertical distance of the shadow from the shape. 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 is the syntax −context.shadowOffsetY=num;Here, num represents the vertical distance in pixels. Let us now see an example to implement the shadowOffsetY property of canvas −Example Live Demo    var c = document.getElementById("newCanvas");    var ctx = c.getContext("2d");    ctx.shadowBlur = 30;    ctx.shadowOffsetX = ... Read More

Select Fields from One Table and Insert to Another in MySQL

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

205 Views

Let us first create a table −mysql> create table DemoTable1    -> (    -> StudentId int,    -> StudentName varchar(20)    -> ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 'John'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1 values(11, 'Chris'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;Output+-----------+-------------+ | StudentId | StudentName | +-----------+-------------+ | 10 | John ... Read More

Advertisements