Set Raised and Lowered EtchedBorder for Components in Java

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

275 Views

To set raised EtchedBorder −Border raisedBorder = new EtchedBorder(EtchedBorder.RAISED);To set lowered EtchedBorder −Border loweredBorderEtched = new EtchedBorder(EtchedBorder.LOWERED);Now, set both the borders for components −JButton raisedButton = new JButton("Raised Border"); raisedButton.setBorder(raisedBorder); JLabel loweredLabel = new JLabel("Lowered Border Etched"); loweredLabel.setBorder(loweredBorderEtched);The following is an example to set raised and lowered EtchedBorder for components −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.SoftBevelBorder; import javax.swing.border.EtchedBorder; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Demo");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       ... Read More

8085 Program to Determine if the Number is Prime or Not

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

3K+ Views

In this program we will see how to check a number is prime or not using 8085.Problem StatementWrite 8085 Assembly language program to check whether a given number is prime or not.DiscussionHere the approach is little bit different. We are actually counting the number of unique factors. For prime numbers the factors are only two. The 1 and the number itself. So if the result is 02H, then it is prime, otherwise not a prime number. As there is no division operation, we have to perform division by subtracting repeatedly.InputAddressDataF10007 AddressDataF100FF AddressDataF1002F Flow Diagram ProgramAddressHEX CodesLabelsMnemonicsCommentsF00021, 00, F1 LXI H, F100Point to F100 to take ... Read More

Empty an Array in JavaScript

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

849 Views

There are a couple of ways to empty an array in javascript.Let's suppose take an arrayvar array1 = [1, 2, 3, 4, 5, 6, 7];Method 1var array1 = [];The code above will set the number array to a new empty array. This is recommended when you don't have any references to the original array 'array1'. You should be careful with this way of empty the array, because if you have referenced this array from another variable, then the original reference array will remain unchanged.Example var array1 = [1, 2, 3, 4, 5, 6, 7];  // ... Read More

HTML Canvas Stroke Method

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

2K+ Views

The stroke() method of the HTML canvas is used to draw the path. This path is drawn with moveTo() and lineTo() method. 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 −ctx.stroke()Let us now see an example to implement the stroke() method of canvas −Example Live Demo    var c = document.getElementById("newCanvas");    var ctx = c.getContext("2d");    ctx.beginPath();    ctx.moveTo(100, 200);    ctx.lineTo(100, 100);    ctx.strokeStyle = "blue"; ... Read More

MySQL Query to Select Count on Two Separate Conditions

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

255 Views

Use CASE statement for this. Let us first create a table −mysql> create table DemoTable    -> (    -> StudentMarks int,    -> isValid tinyint(1)    -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(45, 0); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(78, 1); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable values(45, 1); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable values(78, 1); Query OK, 1 row affected (0.22 sec) ... Read More

Area of a Circle Inscribed in a Regular Hexagon

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

3K+ Views

The circle inscribed in a regular hexagon has 6 points touching the six sides of the regular hexagon.To find the area of inscribed circle we need to find the radius first. For the regular hexagon the radius is found using the formula, a(√3)/2.Now area of the circle inscribed is 3πa*a/4SampleSide of hexagon − 4Area = 37.68Example Code Live Demo#include int main(void) {    int a = 14;    float pie = 3.14;    float area = (float)(3*a*a*pie/4);    printf("The area of circle inscribed in the hexagon of side %d is %f", a, area);    return 0; }OutputThe area of circle ... Read More

HTML DOM Input Week StepUp Method

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

76 Views

The HTML DOM Input Week stepUp() method defines the amount of weeks the week field should increase.SyntaxFollowing is the syntax −Calling stepUp() method with a number, which by default is equal to 1inputWeekObject.stepUp(number)ExampleLet us see an example for Input Week stepUp() method − Live Demo Input Week stepUp()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Week-stepUp( ... Read More

Get Last 12 Digits from a String in MySQL

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

1K+ Views

You can use RIGHT() function from MySQL to get the last 12 digits from a string. Let us first create a table −mysql> create table DemoTable    (    Number varchar(200)    ); Query OK, 0 rows affected (0.59 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('7437647847847474374747464647484949959958484'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('9990000399494959697080800007007070808080808'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('1211111212344554444443333345555554433333333333333'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable;This will produce the following ... Read More

Get JDBC Minor Version using DatabaseMetaData in Java

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

74 Views

The getJDBCMinorVersion() method of the DatabaseMetaData interface returns the minor version of the JDBC driver in integer format.To get the major version of the JDBC driver −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user name, password of a user in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the getMetaData() method of the ... Read More

How to Earn Bitcoins

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

193 Views

Bitcoin is the latest buzz in the world of digital currency at the moment and those who see its significance from a permissive outlook, they go for it because they know it that through this magical currency they can make money faster and become rich. Well, I am sorry to burst that bubble, but to be honest; Bitcoin is like any other currency out there. Like there is no easy way to make money, similarly, there is no other or magical way to gain cryptocurrency or Bitcoins too.However, cryptocurrency may open up a new method of earning, but the basic ... Read More

Advertisements