Skip to main content

All Questions

Tagged with
0 votes
2 answers
65 views

Component not visible after using "setVisible(true)" on it and its parent

I've got a Java 8 app with a couple of JTextFields and a JButton to log into a database and a JTextArea inside a JScrollPane to display errors. Both the textarea and the scrollpane have to be hidden (...
Neph's user avatar
  • 1,941
0 votes
0 answers
6 views

How can I change the visibility of a relativelayout in RecyclerView inside Another activity

How can I change the visibility of this relativelayout progressBarRelativeLayout in this RecyclerViewAdopter inside another activity package com.google.gemini; import android.content.Context; ...
Carl 's user avatar
17 votes
2 answers
15k views

How can I fix warning that Class 'Shape' is exposed outside its defined visibility scope?

I made function 'warn' in line 17 whose parameter is enum Shape. Why is it warning about visibility scope and how can I fix it? import java.util.Scanner; public class AreaCalculator { enum Shape ...
hong's user avatar
  • 183
0 votes
1 answer
119 views

How do I use a JDK class that isn't visible to me?

I am new to Java so please bear with me. I am trying to use the JDK class "com.sun.tools.example.debug.expr.ExpressionParser". When I compile my code, I get the following error: "...
gcworker44's user avatar
0 votes
1 answer
58 views

Writing to a volatile field and reading another volatile field: Is the happens-before-rule valid?

Question: Is this statement true: „A write to a volatile field happens-before every subsequent read of that or another volatile field.“ On How to understand happens-before consistent I found the ...
dibo's user avatar
  • 1
0 votes
0 answers
151 views

What are the visibility rules for package com.sun.tools.javac.code in oracle open jdk version 20?

I am writing a database management program in java in maven in intellij IDEA. For now, the code is only connecting me to the database in MySQL. The code itself has no errors. However, upon running it, ...
amama's user avatar
  • 1
3 votes
1 answer
128 views

Can BlockingQueue make MemorySegment visible for multiple threads?

I am using JDK20's FFI, and I need to pass a Object to a BlockingQueue to shared it from one thread to another. The Object contains several MemorySegment field, which belongs to Arena.openShared(). ...
benrush's user avatar
  • 197
1 vote
1 answer
309 views

Do inherited methods use the visibility, methods and attributes of the superclass or subclass?

What I assume is that an inherited method will, by standard, use the methods and attributes of the class whose object is used to execute that method. Here's an example for my question, it's from a ...
grecode97's user avatar
2 votes
1 answer
553 views

Get all visible windows with JNA

I am programming an overlay in Java showing information for multiple windows. I need it to follow the window that it is tracking, and to do this I regularly take information about the current windows ...
Noah Fraiture's user avatar
0 votes
1 answer
238 views

'void android.widget.LinearLayout.setVisibility(int)' on a null object reference when i want to display a LinearLayout

I have a problem with a button that modifies the visibility of a LinearLayout I always get the error java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout....
11itachikun's user avatar
3 votes
2 answers
941 views

How to hide the VS Code bar with file name, breadcrumbs, and action buttons?

I'd like to hide the toolbar visible in the screenshot: I can hide the menu bar by going into full-screen mode, but I haven't been able to get rid of the bar with the file name, run button, split, ...
Jacob's user avatar
  • 31
1 vote
2 answers
388 views

Android Studio If-statement make TextView visible if invisible and invisible if visible

I am trying to make a textView invisible when pressing a button. But, if the textView is already invisible I want it to become visible. Currently I am trying sonething like this: public void ...
FilleFrella44's user avatar
0 votes
0 answers
49 views

How can I use a updated list in other if-else block?

I am a beginner and working with IntelijIDEA configurations first time. Conditions of a task is: When starting the program with the -c parameter, the program should add a person with the given ...
TheRedBaron43's user avatar
0 votes
2 answers
59 views

How to change location of Textview

I have a Linear Layout inside of Constraint Layout. The cardview visibility changes depending on the data. How to align start textview1 and textview2 if cardview visibility is invisible ?
k.kbr's user avatar
  • 45
-4 votes
1 answer
56 views

Which is better answer about security? [closed]

We have the next source of a Java class and some possibilities to secure its variables: public class Foo { public static String ALPHA = "alpha"; protected String beta = "beta&...
Pete's user avatar
  • 1
2 votes
1 answer
256 views

How to dynamically check table is available ("waiting") using Selenium instead of having a fixed sleep

Code block: private void SelectRows() { var wait = new WebDriverWait(Driver, TimeSpan.FromMilliseconds(500); // enabling the Rows this.Page.EnableRowsButton.Click(); wait.Until(_ => this....
Tin Nguyen's user avatar
  • 5,310
0 votes
1 answer
70 views

Is there a visibility problem with this initialization method?

Visibility problem: When multiple threads call method handle(), is the variable redisTemplate the initialized value, or is it null in some cases? Example here: public class InnerStaticClassExample { ...
TiaJiang's user avatar
0 votes
1 answer
31 views

How do I referente all ImageView in android studio? (java)

I have 5 ImageViews, and i want to hide all. My code: findViewById(R.id.foto1).setVisibility(View.INVISIBLE); findViewById(R.id.foto2).setVisibility(View.INVISIBLE); findViewById(R.id.foto3)....
Crypto World Cup's user avatar
1 vote
1 answer
169 views

Android: Changing Views visibility on Activity start | Hide Notification panel on Notification Button click

My app has a Notification that holds a Button. When the user clicks the Button, the app should open (if it was closed) and show a custom dialog, which I've created by a bunch of views. Showing the ...
Nitzan Daloomy's user avatar
0 votes
0 answers
38 views

Adding JPanel on another JPanel on button press

I have created a MainPanel in which I make a bird fly. To this panel, I have to add a PausePanel panel at the press of a button. If I only use pausePanel.setVisible (true / false) when pressing the ...
ilMichigan's user avatar
0 votes
2 answers
47 views

Private and final methods

I am trying to get a better understanding of private and public methods. I am trying to make a private method called GRID_SIZE and let that equal the length(m) of my grid, however, I am getting a ...
user avatar
-1 votes
1 answer
33 views

How to invisible a Linier layout from other activity without using Intent?

I have given here details about my project and I want that when I will click on the Button it will go to the second activity and also it disappears from the second activity layout. Button btnClick; @...
Mhs Shohrawardy's user avatar
-2 votes
1 answer
504 views

Protected variable not accessible within child class in Java

I have the following structure - App.java - package JohnParcellJavaBasics.AccessModifierDemo; import JohnParcellJavaBasics.AccessModifierDemo.*; public class App { public static void main(String[]...
Payel Senapati's user avatar
0 votes
1 answer
351 views

JavaFX Linechart with logarithmic axis not updating well [closed]

I have two linecharts in my application. One is with linear axis and the other is with logarithmic axis. When I want so view only one series in the charts I set the other series and their data not ...
GRETA 's user avatar
  • 61
0 votes
0 answers
114 views

Questions about visibility of Java volatile field

I am just starting to learn about java multi-threading and have been troubled with keyword volatile a lot. Many tutorial talk about the visibility of volatile field, just like "volatile field ...
pythonHua's user avatar
1 vote
0 answers
59 views

Android: "Can't resolve method 'setVisibility' in group"

This piece of code fails to compile because the method setVisibility() cannot be resolved. public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { super.onViewCreated(view, ...
Mayur Chauhan's user avatar
0 votes
2 answers
106 views

How can i eliminate Empty spaces in recyclerView when trying to hide cards with null properties?

Empty spaces in recyclerView when trying to hide cards with null properties Hi, i'm new here. So this is my first question. I am trying to use the google Books API for a task and when I implement ...
Leo Rodenas's user avatar
0 votes
1 answer
819 views

Intellij cannot resolve method even though it is public (Java)

I have googled this a lot, invalidated the cache, and I can't seem to find an answer. For background, this is a timetabling system using constraint solving. I have a custom class called Period with ...
Donagh's user avatar
  • 109
0 votes
2 answers
919 views

How to change visibility of textview on button click without providing ID to them?

In this I need to know that how do I access a view without providing the Id to them in this there will be no id provided in any of the file. Without the use of external libraries like viewbinding, ...
Khush Pajwani's user avatar
-1 votes
3 answers
416 views

Java Overridden method visibility scope

How is the following program correct? abstract class Calculate { abstract int multiply(int a, int b); } public class Main { public static void main(String[] args) { ...
rahul sharma's user avatar
0 votes
2 answers
491 views

How to set visibility GONE of a Linear Layout which is inside a scroll view and contains two TextViews inside?

The main layout is a Linear layout inside that a scroll view is there which contain sublayouts. Here is my layout [omitted everything except the specific layout (marked with red) as it will be very ...
s4surajverma's user avatar
0 votes
1 answer
53 views

Make display data textviews invisible until a city is searched

I set my textviews on my weather app to display the data for cities when searched on my search panel (i.e temp_out.setText(response.body().getMain().getTemp() + " ℃"););. It works quite fine ...
Richard Wilson's user avatar
27 votes
3 answers
949 views

Why is the data array in java.util.ArrayList package-private?

In the java.util.ArrayList class, the object array for the list's elements is defined as package-private: transient Object[] elementData; // non-private to simplify nested class access The comment ...
Andreas Schörgenhumer's user avatar
0 votes
3 answers
222 views

Visibility guarantees of atomic variables

Having read lots about volatile, atomic and visibility, one question remains. Following works across threads, "a" is visible all the time, when "b" is updated/read: int a; volatile ...
lockfreecode's user avatar
0 votes
2 answers
101 views

Creating subText with visible/invisible method across TextViews

I have created two textViews that the first one is the main title and the second one is the subtext of the title. So I want to make the subtexts visibility to depend on clicking the main title. It ...
Cingen's user avatar
  • 59
0 votes
1 answer
911 views

Issue with RecyclerView and GONE visibility

I am having an issue with RecyclerView and the visibility of some views of their CardViews. As you can see in images 1 and 2, I have a CardView with some TextViews in a RelativeLayout and an ...
Emili Bellot's user avatar
1 vote
0 answers
26 views

SharedPreferences always returning true (recycler view)

I'm using sharedpreference to save boolean when clicking on a button, and use it at the start of the activity to set visibilities states. The problem is that it seems to be always returning true, and ...
Hugo Becker's user avatar
0 votes
1 answer
127 views

Unable to change visibility based on sharedpreference inside recyclerAdapter (Viewpager2)

I got a Viewpager2 adapter , with 2 EditText and 2 TextView in it. At the beginning, the EditTexts are visible, and the Textviews are gone. If I click on a button, if what is written inside 1 (or both)...
Hugo Becker's user avatar
-1 votes
1 answer
645 views

how to change visibility a view in a fragment from the activity

As stated in the title how can change visibility a view in a fragment from the activity? My code has a launch activity and a fragment. I want to change the visibility of a view inside fragment from ...
Ali Azimi's user avatar
1 vote
1 answer
653 views

WHY Java doesn't have the concept of Subpackage visibility [duplicate]

Java doesn't have the concept of Subpackage visibility I know that :( Java: Subpackage visibility? so if I have a Class A (package visible) inside the package com.example.foo and another Class B (...
gixlg's user avatar
  • 1,313
2 votes
1 answer
1k views

Java Android Badge Drawable not working properly after configuration change

I have a Bottom Navigation view with a badge drawable that shows new chats. This badges are updated upon a listener to Firebase database, where I store the notification counter. When this value ...
E. Tocchi's user avatar
-2 votes
2 answers
109 views

variable visibility from calling function [duplicate]

I have 2 classes. In one class i have 4 variables. I instantiate another class and use methods which use these variables. I dont want to pass them as parameters. They are set to public. Both classes ...
xxsurajbxx's user avatar
3 votes
1 answer
1k views

How to make Java class invisible outside its module for other non-modular projects?

Recently I've found out that if a package inside a module contains public interfaces or classes they are being exported automatically and hence unintentionally visible outside the module in case when ...
diziaq's user avatar
  • 7,542
1 vote
1 answer
132 views

How to handle ConstraintLayout horizontal & vertical with view.GONE

already use vertical and horizontal chain in constraint for handle visibility gone. But they are not enought for the thing i want to do. I need to set a view like this example: 1 2 3 4 5 6 And, for ...
Lethans's user avatar
  • 11
0 votes
1 answer
806 views

Show/Hide BottomNavigationView for specific fragment

In my android application, I want the bottom menu bar to disappear when the user focuses the SearchView (this also pops the soft keyboard up). When the SearchView loses focus, I want to show the ...
George's user avatar
  • 409
0 votes
1 answer
376 views

Problem with setting visibility of cardView in recyclerView

Hello I have a problem with setting the visibility of the cardView part. <?xml version="1.0" encoding="utf-8"?> <LinearLayout(..........)> <androidx.cardview.widget.CardView ...
Adam Jefer's user avatar
0 votes
1 answer
56 views

Flag from AsyncTask class doesn't work properly in main class

I've created some lines of code which are supposed to switch to the next activity if connection is set without any exceptions. But if there are some exceptions, it should make "Error!" toast and not ...
user avatar
0 votes
1 answer
446 views

Changing the visibilty of a label

i'm new to Java and experience a little bit with the WindowBuilder. I want to change the visibility of a different components like labels or textfields. So I wrote an example code: the function is, ...
N T's user avatar
  • 3
0 votes
1 answer
81 views

JButton Only Works When Visibility is Set to True-Java

I am trying to make a simple checkers game basically, and I need the user to only be able to see the tiles and the pieces, not the button. When I set the visibility to True, the program works by ...
Sean.D's user avatar
  • 97
0 votes
1 answer
375 views

protected method vs protected property

Subclasses need to be able to use the seeded random number generator. What are the pros and cons of using public abstract class AbstractClass { protected Random rnd; public AbstractClass(long ...
minseong's user avatar
  • 11.7k

15 30 50 per page
1
2 3 4 5
10