How to Make a Clear Button + Numeric and Missing Input Error Message on a Java GUI – Java #60

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error *Error Message code is in the dagbaGUI class //---------------Main Function Screenshot //----------------Main Function Code /**************************************************** Programmer: Akinwale Owi Company:Dagba Computers Program Description:Show how to make a numeric and missing input error message on a GUI ***********************************************************/ package dagba.computers;... Continue Reading →

Format Doubles to Dollars in Java – Java #59

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error --------------Code Screenshots------------ ---------------------Beginning of Source Code------------------------- /**************************************************** Programmer: Akinwale Owi Company:Dagba Computers Program Description:Format Doubles to Dollars ***********************************************************/ package straightcash; //imports import java.text.NumberFormat; import java.util.Scanner; //scanner to read in values import java.util.Locale; //for location public class StraightCash {... Continue Reading →

Use of ‘this’ in a class – Java #58

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error Using 'this' inside of class makes naming variables easier and your code easier to read class containing this screenshot: -------------beginning of source code of class containing this------------ package dagbaComputers; public class SampleClass { private String custName;//string that will... Continue Reading →

Overloading Constructors – Java #56

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error I used eclipse so I will separate main file and the class I built the constructor in, each with their own screenshots and source code. Screenshot Main File, no imports --------------Beginning of Source Code Main File------------------------ //Programmer:Akinwale Owi... Continue Reading →

How to change a JLabel Font Size and Style – Java #55

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error ------------------Output---------------- //------Font Code (Full Source Code Below)--------------------------------------------- //Creating the second JLabel JLabel secondLabel = new JLabel("Spot 2"); //Creating the font Style + Bold,Plain,Etc, + Size Font format = new Font("Impact", Font.ITALIC, 40); //setting secondLabel font to our new... Continue Reading →

How to Swap Array Values in A Single Dimension Array – Java #54

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error -------------------Output--------------- ---------------------Beginning of Source Code------------------------------- //Programmer: Akinwale Owi //Company: Dagba Computers //Program Purpose: Swap values in an array package javaapplication40; public class JavaApplication40 { public static void main(String[] args) { //creating the array that I will switch the... Continue Reading →

Java #53: How to Print only up to Two Decimal Spaces with printf in Java

*Watch copying and pasting the quotation marks, you may have to retype them to avoid an error ----------------------------Output----------------------------- --------------------Beginning of Source Code------------------------------- //Programmer: Akinwale Owi //Company: Dagba Computers //Program Purpose: Print only up to two decimal places in java using printf package javaapplication39; public class JavaApplication39 { public static void main(String[] args) { //Double we... Continue Reading →

Blog at WordPress.com.

Up ↑