When I create a new class file,
even though I turn off this option "When files are created: Do not add",
always "Add file to git" notification harass me...
I'm not sure if this is exactly what you're looking for but let me try.
Settings marked with a console icon are only applied to the current project(Read this article). So when you create a new project (or open a new project), it defaults to "Ask". However, you can change that in File -> New Projects Setup -> Settings for New Projects... which will open the same settings window for you but these settings will be applied by default if you create/open new projects in Intellij. Setting this to "Do not add" should be enough to never get the "Add file to git" pop-up window again.
Related
I've been trying to run gui in netbeans using java swing but it won't run at all. All the projects that I execcute that uses jframe does not run. Any tips on how to fix this thing? This is how it looks like:
I got this to run with no problems using NetBeans IDE 8.2. Let's start from the beginning.
Delete your current OfficeManagementSystem project from your IDE and local drive system. Select the OfficeManagementSystem project located within your IDE Project pane located on the left side of the IDE. Right-click on it and select the Delete popup menu item. A Delete Project dialog is displayed. Check-mark the Also delete sources under ..... checkbox then select the Yes button.
Close NetBeans!
To make sure all is gone, open your file browser (in Windows10 this is named File Explorer [win key + E]) and navigate to your NetBeans Projects folder. Default location in Windows is C:\Users\{yourAccountName}\Documents\NetBeansProjects\. Make sure that OfficeManagementSystem project folder is deleted.
With your web browser, go to the Source Code Web Page and select the Code button:
Then from the dropdown menu select Download ZIP:
A Save File dialog will appear possibly similar to this:
Select the Save File option then select the OK button. Choose a location to save the ZIP file and remember it.
Navigate to you downloaded file named HospitalManagementSystemusingJAVASwing-master.zip and Un-Zip it with your favorite decompression software like WinRar or 7Zip. Have it unzip into its own folder.
Navigate to and open the the folder created by your decompression software, it should have been named HospitalManagementSystemusingJAVASwing-master. If done properly you should have yet another folder (a sub-folder) also named HospitalManagementSystemusingJAVASwing-master. Rename this folder to HospitalManagementSystem by right-clicking on the folder and selecting Rename from the popup menu. Delete the unnecessary text within the name then hit your ENTER key.
After Renaming the folder, once again right-click on it and select Copy from the popup menu.
As described earlier, navigate to you NetBeansProjects directory (folder) and double-click on it. Paste the new HospitalManagementSystem folder into the NetBeansProjects folder. This project will now be added to the NetBeans Projects List.
Start NetBeans!
Once NetBeans has completely started, from the menu bar select the File ➞ Open Project... menu item. The Open Project dialog will be displayed. Scroll down the left pane of this dialog until you see HospitalManagementSystem and select it. Now hit the Open Project button. This project will load into the NetBeans IDE Projects pane located on the left side of your IDE under the name of: OfficeManagementSystem. Why this person changed the project name at this point is beyond me but to each their own.
Expand the project and its active package (officemanagementsystem) so as to expose all the classes involved. You should see the following listed:
LoginPage.java // The first Form we want displayed.
MenuPage.java // The Menu page (once login is achieved).
Module1.java // Should really be named PatientPage
Module2.java // Should really be named DoctorAvailabilityPage.
OfficeManagementSystem.java // The application start-up class.
This application still will not run since it contains nothing within the main() method of the start-up class (OfficeManagementSystem). Open this class into the IDE Editor by double-clicking on it.
Expand the main() method code block and add this code line into it:
new LoginPage().setVisible(true);
Run the application! The first Window displayed will be the Login Page. Username is: admin and the password is: admin. (change in code if you like). And away you go. :)
All java applications need a static main method as a bootstrap.
It should look something like the following:
public static void main(String[] args) { YourJFrameClass frame = new YourJFrameClass(); }
That should get you started.
The easiest method is to press Shift+F11 (Clean and Build Project), then hit F6 to run it.
It refreshes Netbeans appropriately and finds your main without all the manual labor; and if you have multiple mains, it will give you the option to select the correct one.
Check if your JFrame Class has this method:
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new YOURFORMNAME().setVisible(true);
}
});
}
The setVisibile(true) allows the form to be visible to the user. The main method is used to define the entry point for the application therefore this method is needed to run the JFrame
I am currently doing a free Java course online called MOOC made by the University of Helenski. One challenge requires us to create new packages and such. The main issue I was having was that my code would not compile because it would refuse to acknowledge the Main class I created for it, even after I manually selected it (see one of the screenshots below).
I have found solutions of this challenge online and all the packages are created in a folder called "Source Packages" . The problem I am having is that every-time I create a new package, it automatically shows up in the "Test packages" folder.
I tried looking online to see how I can create a "Source Packages" folder on Netbean but I have not been successful in finding out how to go about this because this challenge is not letting me create a "Source Packages" folder. I am fairly new with Java and any help is appreciated. Thank you.
It seems that you have just created the wrong project type. Is it possible that this is a TMC project and not a normal Java-Application? Then it would make sense, that there are only test-packages available.
If this folder is missing, you can create it like this:
1.) Create a new folder:
Right-klick on your project in projectexplorer -> new -> other:
New-File-Window opens: on the left list klick "other", on the right list klick "folder", then klick next.
Now you can choose Foldername and Location. Click finish and the new folder is created.
2.) Set the new created folder as new source:
Right-klick on your project, select "properties", then on the opening "Project-Properties" Window in the list on the left side klick "sources", then on the right lower list you can add the created folder (klick add...)
Finally click ok and the folder should appear in your Menu.
I have a critical issue over here.
Please find my scenario below:
login
click on a link
after the click, a new tab opens
I have switched the focus to the new opened tab with the following code
ArrayList<String> newTab = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(newTab.get(1));
The issue is that when I try to click on an excel download link on the newly opened tab, the "Open with" popup is appearing and my automation fails. Even after adding the following preference
firefoxProfile.setPreference("browser.helperApps.neverAsk.openFile",
"text/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"text/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
Please, can you suggest a feasible solution as soon as possible?
Thank you
Please manually set these preferences in your firefox's(about:config) section, visit the application, click the link and see if the file gets downloaded without any prompt. This will help you to identify the issues with automation.
I tried setting these preferences in my firefox, but it still prompts download window. I can download without prompt only after checking "Do this automatically for files like this from now on" which updates mimeTypes.rdf file in the profile directory. So to make this work through automation, you may need to bundle a custom firefox profile that includes a mimeTypes.rdf with your TestSuite.
Here's the code to create FirefoxProfile from a given profile directory:
FirefoxProfile profile = new FirefoxProfile(new File("<PATH_TO_FIREFOX_PROFILE_DIRECTORY_THAT_WORKS_WHEN_TESTED_MANUALLY>");
WebDriver driver = new FirefoxDriver(profile);
One frustrating thing I find in Intellij's project view is that it shows all the classes in a file instead of just the class for which the file is named.
The problem with this is that to open a file I have to double click twice: once to expand the file and show the classes in the file, and then a second time to actually open the file.
In most cases I don't want to see the classes inside of a file. I just want to see the file in the project view and when I double click on the file I want to open the file, not drill down into its structure.
Is it possible to configure my UI this way?
UPDATE: further explanation
Apparently people are having problems understanding this question. See the above picture of the Intellij Project navigation pane. Notice that some classes (the blue circles) have a + sign and others do not. The ones with a plus sign are files that have multiple classes inside of them.
The problem is that if you double click on a file with only one class (no plus sign) it opens (GOOD), but if you double click on a file with multiple classes in it (has plus sign) then the file does NOT open, it just expands the plus sign to show you the individual classes in the file as BoxArray.java, for example (BAD).
For example, if I double click on the file Coastline.java in the view above it will NOT open the file, it will expand the plus sign. I want it to open Coastline.java when I double click on Coastline.java, not expand it. I do not care about seeing the classes inside of a class file, I just want to open it in one double click.
I know that I can use the hotkey F4 to do this. I do not want to reach for the F4 key. I want to double click on the file and have it open.
When you enable Autoscroll to Source in the little menu of your Project tool window (View > Tool Windows > Project), single clicking a collection (closed and opened) goes straight to the code as well as folding / unfolding it.
This works in IntelliJ 13.1 and 14 (in OSX and Linux)
You could bind Jump to Source function to double click in Settings -> Keymap -> search for "Jump to Source" -> RMB click and choose "Add Mouse Shortcut".
Now double clicking on file will open it. Drawback could be that from now if you double click on some code to select it you will always go to source..
There is a way to open a file without unfolding/drill down via "jump to source" action. Unfortunately, you need a keyboard to do this. On Mac you use F4/⌘↓/⌘Enter, on linux/windows it is F4/Ctrl+Enter.
go to file -> settings -> Editor -> General -> editor tabs
in tab closeing policy and set tab limit and set it to what number you want.
You can avoid navigating through mouse and even double clicking on the file by making use of the shortcut ctrl + shift + n and just start typing the file name or even just first letters of the words( ex: BA for BoxArray) and select the file. Which will open without asking the class name!!
I use Netbeans 7 on Kubuntu 12.04. I start Netbeans like this:
netbeans --cp:a /usr/share/java/xercesImpl.jar &
cause of known issue with Netbeans and Kubuntu 12.04. In the middle of my project my palette with Swing components just .. disappeared!
I see only sth like this:
How to restore default Netbeans palette?
I checked Ctrl+Shift+8 shortcut but with no results - the problem is still the same.
**EDIT:
I dont know what I did but now I see ONLY EMPTY palette :( : **
I also tried this:
1) I cd'ed to /home/mazix/.netbeans/7.0/config/Windows2Local/Groups/commonpalette
, ls'ed and saw only this: CommonPalette.wstcgrp
2) cd'ed to /home/mazix/.netbeans/7.0/config/Windows2Local/Components and saw this:
AnalyzerTopComponent.settings output.settings
AnalyzeStackTopComponent.settings projectTabLogical_tc.settings
breakpointsView.settings projectTab_tc.settings
CallHierarchyTopComponent.settings properties_1.settings
callstackView.settings properties.settings
CommonPalette.settings refactoring-preview.settings
ComponentInspector.settings
ReporterResultTopComponent.settings CssPreviewTC.settings
resultsView.settings debugging.settings
search-results.settings DeclarationTopComponent.settings
services.settings evaluator.settings
sessionsView.settings favorites.settings
sources.settings find-usages.settings
StyleBuilderTC.settings gsf-testrunner-results.settings
svnversioning.settings hgversioning.settings
synchronize.settings JavadocTopComponent.settings
TaskListTopComponent.settings localsView.settings
TerminalContainerTopComponent.settings
MultiView-java#007Cform#007C_1.settings threadsView.settings
MultiView-java#007Cform#007C_2.settings versioning_output.settings
MultiView-java#007Cform#007C_4.settings watchesView.settings
MultiView-java#007Cform#007C.settings Welcome.settings
navigatorTC.settings
and didnt see any _hidden files :(
Open NetBeans and choose Window -> Palette
It will appear but it will be empty because you didn't choose a GUI class yet.
To fill the palette with the GUI components like labels, follow these steps:
Create a new project .
Right click in the package name or project name, and choose New -> Other...
In the New File dialog box, choose the "Swing GUI Forms" from category and the "JFrame"
Form file type sub window. Click Next.
Enter name lets say "MyGUI" for the new the class which you created now.
The palette window is now full with components like labels, text,checkboxes, ...
if not appear yet make sure to press "Design" button in the upper of the GUI class bar "MyGUI"class
I got the same issue and this work for me window -> reset window. hope it work for you :)
I think the same problem occur here.Check this solution.it may helpful to you.
This steps for restore the default palette?
Exit the IDE.
Go to your user directory and go down to config/Palette subdir. In this directory, the files or directories deleted from the default palette content are presented as empty files with _hidden suffix in their names.
Delete these _hidden files to let the palette categories and items appear again in the IDE.
I think this will help you
Do one thing, simply right click on your netbeans project and then open it. It resolves the problem. You will observe if u open a new project the palette is there, so just copy the project with a different name, its will solve your problem.
In my case after creating a new project without a default constructor, the search box at the palette holds a single character i.e. '='. this results in an empty palette too.
In that case the solution is obvious: just delete the content of the search input.
It puzzled me for a moment, though, not noticing the search input field content.
I had the same situation with my netbeans. The only solution I did was to backup my project folder (saving it to other drive). Then re-install the netbeans. Afterwards I re-paste the project folder at the directory and re-open it.
Right-click mouse button at palette box. Choose command "reset palette".
I encountered the same problem. Just check the bottom of the palette to see if there is a search box open. If there is, close it. Then the palette will be available once again.
So, nothing suggested here worked for me, I am leaving my solution.
You create the project, name it.
Create a package.
Click on the package with the right mouse button
select New filme
select Other
select AWT GUI Forms
select Frame form
Now you should see the menu at the right part of your screen with the option to create buttons, labels, etc.
As of 2021 for mac users;
Open your NetBeans app and click on "windows" located at the top menu of the application. A drop down will appear.
Scroll down and click "IDE Tools". You'll see another dropdown containing list of items including palette.
Click on the "palette". This will make the palette visible.
That's all!