Making a Java Swing JFrame Transparent

programming

This is how you can create a transparent JFrame in JAVA. public class transparentJFrame { public static void main(String[] args) { new transparentJFrame(Date, Head, Detal); } public transparentJFrame(String Date, String Head, String Detal) { JFrame frame = new JFrame(); frame.setUndecorated(true); frame.setBackground(new Color(Color.black.getRed(), Color.black.getGreen(), Color.black.getBlue(), 1)); //Change value of ‘1’ above to have diff transparency ((JComponent) frame.getContentPane()).setBorder( BorderFactory.createMatteBorder(3, 2, 2, 2, Color.black)); frame.setBounds(100, 50, 500, 400); frame.getContentPane().setLayout(null); final JLabel lblX = new JLabel(“X”); lblX.setBounds(frame.getWidth() – 15, 5, 15, 15); lblX.setForeground(new Color(255, 255, 255)); lblX.setToolTipText(“Closern”); lblX.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent…

Read More

Wi-FI Remote for MI TV using ESP8266

I got an MI Smart TV and was pretty much interested in including that in my Home Automation system (OpenHAB). It is supposed to be controlled so that it can be turned on or off based on profile and scene. Although the TV does support MI TV remote over Wi-Fi, it is not able to turn on the TV when it is off. The easiest way to do so is to replicate the remote to an ESP8266 board is having an IR LED and Wi-Fi. By using it everything that…

Read More

Sending SMS using GSM Module and LPC2148

SIM300 GSM Module

When accessing GSM networks comes in picture in embedded system ,the only way around i to use GSM/GPRS modules which provides RS-232/UART interface and supports for AT command sets (Commands used for calling,Messaging etc) and usually easy to integrate with embedded modules. Some of the modules manufactured by SIMCOM are widely used as they are pretty cheap and are easily available.This post is about connecting a SIM300 module to LPC2148 using UART and send message to a mobile number. The SIM module is connected to the LPC2148 by using the…

Read More

Cheap LoRa Gateway using Pi & RAK831

RAK831 LoRa Gateway

Lately, I have been working with LoRAWAN and I don’t have Lora gateway around. As you might be knowing LoRAWAN network requires a gateway to push data to the internet. As Lora is not an IP based protocol the gateway helps it in doing so. Basically, multiple LoRAWAN nodes transmit data to the gateway and the gateway transfers the concentrated data to server backend. Server backend which resides in the cloud contains a network server which helps in managing the network and the application server which is responsible for the data and…

Read More

RPi GPIO Programming using Arduino Web IDE

RPi GPIO Programming using Arduino Web IDE

Recently Arduino has launched support for programming ARM-based SBCs by using the Arduino web editor and Raspberry Pi is one of the SBCs in the list. This video is all about the basic setup to get started with the programming of the Raspberry Pi GPIOs by using Arduino codes. The setup is pretty simple and will help you if you are more comfortable in the Arduino ecosystem as compared to python. More depth functionalities are yet to be checked.  

Read More

Arduino: String to Array Conversion based on delimiter

arduino_logo-wallpaper-1920x1200

This is a simple sketch on how to convert any String to Array in Arduino based on any token or delimiter. Whenever you are working on any project which involves data transfer between Arduino and Other devices/micro-controllers using serial or Wi-Fi or Ethernet you might need to transfer chunks of data and usually the data are not mapped unless you are using JSON or XML. Use of JSON and XML works fine, but proper parser needs to be added to the micro-controller to parse the encoded data.  So if required…

Read More

Get Windows PC Uptime using JAVA

programming

This code snippest is about getting the system uptime using JAVA. The way it works is we invoke net stats srv from java using, JAVA Runtime. The command returns the time that the PC has been up for, A sample command in a windows system looks like, Microsoft Windows [Version 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\user>net stats srv Server Statistics for \\DESKTOP-****** Statistics since 3/31/2020 8:49:26 PM Sessions accepted 0 Sessions timed-out 0 Sessions errored-out 0 Kilobytes sent 60 Kilobytes received 53 Mean response time (msec) 0…

Read More

OpenHAB2 Installation on Ubuntu Server (16.04)

Ubuntu and OpenHAB

 In my last post about the installation of Zulu JDK to Ubuntu 16.04 server, I covered how to do so and was required so that OpenHAB can run on my server. This post is in the line of my last post and is about the installation of OpenHAB to ubuntu 16.04 server. This post is all about installing OpenHAB to Ubuntu 16.04 using the manual method. I tried with apt-get, but that didn’t work for me.   STEP 1 (Download OpenHAB runtime): Navigate to a folder where you can download files…

Read More

Install Zulu JDK on Ubuntu

ZULU JDK on Ubuntu

[sg_popup id=”3″ event=”onload”][/sg_popup] Recently I moved my server to Ubuntu from windows. I went with Ubuntu 16.04 server edition as it is lightweight as compared to desktop edition and comes preloaded with some server tools. As I am running OpenHAB for my home automation system I wanted to install it on the server but the server edition doesn’t come with JAVA/JDK pre-installed. As per OpenHAB, Zulu JDK is the recommended JAVA platform and performs better as compared to OpenJDK. Though Oracle JDK can be installed, I thought of trying ZULU.…

Read More

Simple currency converter in JAVA

programming

Here goes a simple JAVA code to convert rupees by using the online yahoo exchange rates. package com.oksbwn.currencyRate; import java.io.IOException; import javax.swing.JOptionPane; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.*; import com.oksbwn.popUp.popMe; public class YahooCurrencyConverter { @SuppressWarnings({ “deprecation”, “resource” }) public float convert(String currencyFrom, String currencyTo) throws IOException { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(“http://quote.yahoo.com/d/quotes.csv?s=” + currencyFrom + currencyTo + “=X&f=l1&e=.csv”); ResponseHandler responseHandler = new BasicResponseHandler(); String responseBody = httpclient.execute(httpGet, responseHandler); httpclient.getConnectionManager().shutdown(); return Float.parseFloat(responseBody); } public void convertToRs() { String to = null; String amnt =…

Read More