 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2527 of 3366
 
 
			
			504 Views
In this article, we will learn to set a background color for JSplitPane in Java. JSplitPane is a Swing component that divides two (or more) components with a resizable divider. By default, JSplitPane does not directly support background color changes due to its complex structure. What is a JSplitPane? A JSplitPane is a subclass of the JComponent class that allows us to arrange two components side by side horizontally or vertically in a single pane. The display areas of both components can also be adjusted at runtime by the user. Syntax The following is the syntax for a JSplitPane initialization: JSplitPane ... Read More
 
 
			
			3K+ Views
A JTable is a subclass of JComponent for displaying complex data structures. A JTable component can follow the Model View Controller (MVC) design pattern for displaying the data in rows and columns. A JTable can generate TableModelListener, TableColumnModelListener, ListSelectionListener, CellEditorListener, RowSorterListener interfaces. We can implement the search functionality of a JTable by input a string in the JTextField, it can search for a string available in a JTable. If the string matches it can only display the corresponding value in a JTable. We can use the DocumentListener interface of a JTextField to implement it.Exampleimport java.awt.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; public ... Read More
 
 
			
			533 Views
In this article, we will learn how to hide the left/right pane of a JSplitPane programmatically in Java. JSplitPane is a simple Swing component in GUI programming that allows hiding one side of the split pane, resulting in a collapsible panel look. JSplitPane A JSplitPane is a subclass of the JComponent class that allows us to arrange two components side by side horizontally or vertically in a single pane. The display areas of both components can also be adjusted at runtime by the user. The important methods of JSplitPane are remove(), removeAll(), resetToPreferredSizes(), and setDividerLocation(). A JSplitPane can generate a ... Read More
 
 
			
			367 Views
This is a famous puzzle problem. Suppose there is a building with n floors, if we have m eggs, then how can we find the minimum number of drops needed to find a floor from which it is safe to drop an egg without breaking it.There some important points to remember −When an egg does not break from a given floor, then it will not break for any lower floor also.If an egg breaks from a given floor, then it will break for all upper floors.When an egg breaks, it must be discarded, otherwise we can use it again.Input - The ... Read More
 
 
			
			274 Views
Here we will see the Euclidean algorithm to find the GCD of two numbers. The GCD (Greatest Common Divisor) can easily be found using Euclidean algorithm. There are two different approach. One is iterative, another one is recursive. Here we are going to use the recursive Euclidean algorithm.AlgorithmEuclideanAlgorithm(a, b)begin if a is 0, then return b end if return gcd(b mod a, a) endExample Live Demo#include using namespace std; int euclideanAlgorithm(int a, int b) { if (a == 0) return b; return euclideanAlgorithm(b%a, a); } main() { int a, b; cout > a >> b; cout
 
 
			
			471 Views
An array of integers is given. We have to find sum of all elements which are contiguous. Whose sum is largest, that will be sent as output.Using dynamic programming we will store the maximum sum up to current term. It will help to find sum for contiguous elements in the array.Input: An array of integers. {-2, -3, 4, -1, -2, 1, 5, -3} Output: Maximum Sum of the Subarray is : 7AlgorithmmaxSum(array, n)Input − The main array, the size of the array.Output − maximum sum.Begin tempMax := array[0] currentMax = tempMax for i := 1 to n-1, ... Read More
 
 
			
			689 Views
The Breadth First Search (BFS) traversal is an algorithm, which is used to visit all of the nodes of a given graph. In this traversal algorithm one node is selected and then all of the adjacent nodes are visited one by one. After completing all of the adjacent vertices, it moves further to check another vertices and checks its adjacent vertices again.In The competitive coding, we have to solve problems very quickly. We will use the STL (Standard Library of C++) to implement this algorithm, we need to use the Queue data structure. All the adjacent vertices are added into ... Read More
 
 
			
			176 Views
Here we will see the atan() method for the complex numbers. The complex numbers can be used using complex header file. In that header file the atan() function is also present. This is complex version of normal atan() function. This is used to find complex arc tan of a complex number.This function takes a complex number as input parameter, and returns the arc tan as output. Let us see one example to get the idea.Example Live Demo#include #include using namespace std; int main() { complex c1(5, 2); //atan() function for complex number cout
 
 
			
			177 Views
Here we will see the asin() method for the complex numbers. The complex numbers can be used using complex header file. In that header file the asin () function is also present. This is complex version of normal asin () function. This is used to find complex arc sine of a complex number.This function takes a complex number as input parameter, and returns the arc sine as output. Let us see one example to get the idea.Example Live Demo#include #include using namespace std; int main() { complex c1(5, 2); //asin() function for complex number cout
 
 
			
			2K+ Views
An arithmetic mean is the average of all the given numbers, which is calculated by summing all the numbers and dividing this calculated sum by the total number of elements. The formula for calculating the arithmetic mean is: $$ \bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i = \frac{x_1 + x_2 + x_3 + \cdots + x_n}{n} $$ Here, we are given an array of integers and our task is to calculate the arithmetic mean of these numbers using the above formula: Scenario 1 Input: num = 2, 7, 4, ... Read More