[Solved] The image’s event handler shows error in Java GUI

Why are you creating new instance of JButton in roll? You just need to change the icon of the buttons which are already displayed on the screen This… public void roll() { value = nextValue() ; if (value==1){ Icon i=new ImageIcon(getClass().getResource(“1.png”)); c= new JButton(i); add(c); } else if(value==2){ Icon im=new ImageIcon(getClass().getResource(“2.png”)); c= new JButton(im); add(c); … Read more

[Solved] Convert String to Date object [duplicate]

This should work as you specified in your question. DateFormat dateFormat = new SimpleDateFormat(“yy-MMM-dd HH:mm:ss a”); System.out.println(dateFormat.format(new Date())); The date format you have in your question is something like: DateFormat dateFormat = new SimpleDateFormat(“yyyyMMddHmmss”); 2 solved Convert String to Date object [duplicate]

[Solved] Throwing exceptions syntax java

You have two issues: 1) Your closing } for the try is inside the if. 2) You are not properly calling the constructor of IllegalArgumentException. Do `throw new IllegalArgumentException(); In the future, you should read and try to understand the compiler message. It is most likely telling you exactly what there errors are and where. … Read more

[Solved] How to parse yyyymm data format to Month, YYYY format in Java?

I would use java.time for a task like this. You can define two java.time.format.DateTimeFormatter instances (one for parsing the input string to java.time.YearMonth and another for formatting the obtained YearMonth to a string of the desired format). Define a method like this one: public static String convert(String monthInSomeYear, Locale locale) { // create something that … Read more

[Solved] Captaincasa grid paging [closed]

As I understand you are looking for a paging/scrolling using buttons (in addition to the normal scrollbar scrolling) to scroll through grid lines. The FIXGRID has some server-side API which allows access/update to the scrolling: FIXGRIDBinding.getSbvalue() ==> current scroll position FIXGRIDBinding.getSbvisibleamount() ==> number of lines currently displayed FIXGRIDBinding.getSbmax() ==> max scroll position FIXGRIDBinding.setSbvalue() ==> set/update … Read more

[Solved] make application with database MySQL is faster [closed]

For db Add indexes for frequently searched fields Think about table partitioning, rarely searched data should be stored in archive tables For backend Optimize queries Minimize cursor fetching For client Use pagination to avoid large data loading Use async loading (SwingWorker for swing, Service for javafx) to avoid UI hanging Don’t mix archive and working … Read more

[Solved] Get single item from List

You should read the documentation of List and Map (respective HashMap) to see how to use them. Since your List contains Map you’ll have to get a Map using the List operations and then get the elements from that Map using the Map operations: HashMap<String, String> firstMap = lst.get(0); String someEntry = firstMap.get(“key”); 0 solved … Read more

[Solved] Inserting data into the PostgreSQL from Java Servlet

Your error is on line 73: birthyear = Integer.parseInt(request.getParameter(“birthyear”)); I’m guessing by your code that the form in the doGet function is the form posting the data you want to store in your database. Your form doesn’t contain a birthyear field. Its absence makes request.getParameter(“birthyear”) return null, which causes a NullPointerException when trying to parse … Read more

[Solved] Java Maven reference files in WebApp

Always remember that Maven’s policy is convention over configuration. That being said, in your case, while using Maven, you need to follow the Maven Standard Directory Structure. Create a directory structure like src/main/java and put your package(s) in the java folder. For any resources, create a folder structure like src/main/resources and put your resources in … Read more